diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2011-05-30 23:00:17 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:18:25 +0300 |
commit | be79e7763abacf98defe3ce84f17984e6ffa99c5 (patch) | |
tree | bf2aed514c733dc37d9d49a64c98b056bdc39a85 /platform/platform_tests | |
parent | cc223b4afcbc5612f931d64023544518155d9a41 (diff) |
Build fixes
Diffstat (limited to 'platform/platform_tests')
-rw-r--r-- | platform/platform_tests/concurrent_runner_test.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/platform/platform_tests/concurrent_runner_test.cpp b/platform/platform_tests/concurrent_runner_test.cpp new file mode 100644 index 0000000000..8e6ed28bf2 --- /dev/null +++ b/platform/platform_tests/concurrent_runner_test.cpp @@ -0,0 +1,30 @@ +#include "../../testing/testing.hpp" + +#include "../concurrent_runner.hpp" +#include "../platform.hpp" + +#include "../../base/logging.hpp" +#include "../../base/mutex.hpp" + +#include "../../std/bind.hpp" + +int globalCounter = 0; + +threads::Mutex m; + +void f() +{ + threads::MutexGuard g(m); + ++globalCounter; +} + +static const int MAX_THREADS = 20; + +UNIT_TEST(ConcurrentRunnerSmoke) +{ + threads::ConcurrentRunner r; + for (int i = 0; i < MAX_THREADS; ++i) + r.Run(&f); + r.Join(); + TEST_EQUAL(globalCounter, MAX_THREADS, ()); +} |