diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-09 10:17:17 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-09 10:17:17 -0700 |
commit | dc7dbc2df71e88615c4f179a2eded7f617fca7a9 (patch) | |
tree | e2a6c5d76adc94e0afb7511cbbcf7eb6751f3ebd /unsupported/test/cxx11_runqueue.cpp | |
parent | 05c365fb16a6ce63688d465e5d30c98a8742407b (diff) |
Optimized the non blocking thread pool:
* Use a pseudo-random permutation of queue indices during random stealing. This ensures that all the queues are considered.
* Directly pop from a non-empty queue when we are waiting for work,
instead of first noticing that there is a non-empty queue and
then doing another round of random stealing to re-discover the non-empty
queue.
* Steal only 1 task from a remote queue instead of half of tasks.
Diffstat (limited to 'unsupported/test/cxx11_runqueue.cpp')
-rw-r--r-- | unsupported/test/cxx11_runqueue.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/unsupported/test/cxx11_runqueue.cpp b/unsupported/test/cxx11_runqueue.cpp index d20d87111..2594ff0c5 100644 --- a/unsupported/test/cxx11_runqueue.cpp +++ b/unsupported/test/cxx11_runqueue.cpp @@ -100,6 +100,14 @@ void test_basic_runqueue() // Empty again. VERIFY(q.Empty()); VERIFY_IS_EQUAL(0u, q.Size()); + VERIFY_IS_EQUAL(0, q.PushFront(1)); + VERIFY_IS_EQUAL(0, q.PushFront(2)); + VERIFY_IS_EQUAL(0, q.PushFront(3)); + VERIFY_IS_EQUAL(1, q.PopBack()); + VERIFY_IS_EQUAL(2, q.PopBack()); + VERIFY_IS_EQUAL(3, q.PopBack()); + VERIFY(q.Empty()); + VERIFY_IS_EQUAL(0, q.Size()); } // Empty tests that the queue is not claimed to be empty when is is in fact not. |