diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-12 11:45:48 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-12 11:45:48 -0700 |
commit | 2a54b70d45f8562bcb7f9f7d669e2f20ea60b3f5 (patch) | |
tree | b7e56b71a40dda25dcea190356ba4c728165af01 /unsupported/test/cxx11_non_blocking_thread_pool.cpp | |
parent | a071629fecdb7aec97804486c25e605ccfdc7fe4 (diff) |
Fixed potential race condition in the non blocking thread pool
Diffstat (limited to 'unsupported/test/cxx11_non_blocking_thread_pool.cpp')
-rw-r--r-- | unsupported/test/cxx11_non_blocking_thread_pool.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unsupported/test/cxx11_non_blocking_thread_pool.cpp b/unsupported/test/cxx11_non_blocking_thread_pool.cpp index 02ffa57cc..6569218c4 100644 --- a/unsupported/test/cxx11_non_blocking_thread_pool.cpp +++ b/unsupported/test/cxx11_non_blocking_thread_pool.cpp @@ -12,6 +12,16 @@ #include "main.h" #include "Eigen/CXX11/ThreadPool" +static void test_create_destroy_empty_pool() +{ + // Just create and destroy the pool. This will wind up and tear down worker + // threads. Ensure there are no issues in that logic. + for (int i = 0; i < 16; ++i) { + NonBlockingThreadPool tp(i); + } +} + + static void test_parallelism() { // Test we never-ever fail to match available tasks with idle threads. @@ -87,5 +97,6 @@ static void test_parallelism() void test_cxx11_non_blocking_thread_pool() { + CALL_SUBTEST(test_create_destroy_empty_pool()); CALL_SUBTEST(test_parallelism()); } |