ext-pmmpthread icon indicating copy to clipboard operation
ext-pmmpthread copied to clipboard

Worker::unstack() removes tasks from the wrong end of the queue

Open dktapps opened this issue 3 years ago • 0 comments

Contrary to intuitively expected behaviour, unstack() actually removes tasks from the front of the queue, rather than the back.

This is a problem for task executions that expect to have state set up by tasks that preceded them, because the earlier tasks might not have actually executed due to the tasks being dequeued and not executed.

Side note: The entire terminology for Worker is wrong. Stacks are a FILO data structure, which implies that tasks stack()ed will be executed before any other tasks on the queue. This is completely wrong. The correct terminology would be enqueue() and dequeue().

dktapps avatar Aug 21 '22 20:08 dktapps