From dc7dbc2df71e88615c4f179a2eded7f617fca7a9 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Mon, 9 May 2016 10:17:17 -0700 Subject: 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. --- unsupported/test/cxx11_runqueue.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'unsupported/test/cxx11_runqueue.cpp') 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. -- cgit v1.2.3