mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user