Commit Graph

5 Commits

Author SHA1 Message Date
a72fdb9ca2 ConcurrentQueue::cancelPending: don't reset jobsLeft to 0
Worker threads may well be executing jobs while this function is being
called. If ConcurrentQueue::waitAll() is called soon enough after
cancelPending(), the worker threads may still be running, but waitAll()
would return immediately as jobsLeft would be nonpositive.

Subtracting _queue.size() from jobsLeft sets this variable to the number
of worker threads that are executing jobs at the moment.

ConcurrentQueueTest::cancelPending1UserThread() passes most of the time
now. But it still fails occasionally because it depends on the timing of
thread scheduling, which is unreliable.
2021-12-29 09:36:44 +01:00
228fe1284e Fix a typo in ConcurrentQueue::cancelPending function name 2021-12-29 09:36:44 +01:00
93596a4972 Restore needed lock 2021-02-08 09:02:19 +01:00
4c93c70de6 Use the right mutex when the queue is modified 2021-02-08 08:32:42 +01:00
fa5ce25425 Add concurrent queue based on lambdas 2021-01-14 09:03:17 +01:00