-
Enhancement
-
Resolution: Fixed
-
P4
-
19
-
b09
NonblockingQueue::append has a somewhat complicated and limited set of invariants for the cases where the queue was (logically) empty and is being changed to non-empty.
When NonblockingQueue::try_pop takes the last element from the queue, it performs some cleanup of the queue _head and _tail. The order of that cleanup is currently _tail then _head. The order doesn't affect the correctness of the algorithm. But if the order were reversed, i.e. _head then _tail, then the invariants in append could be improved. In particular, when append finds a NULL old_tail then the value of _head must also be NULL. That doesn't hold with the current order.
When NonblockingQueue::try_pop takes the last element from the queue, it performs some cleanup of the queue _head and _tail. The order of that cleanup is currently _tail then _head. The order doesn't affect the correctness of the algorithm. But if the order were reversed, i.e. _head then _tail, then the invariants in append could be improved. In particular, when append finds a NULL old_tail then the value of _head must also be NULL. That doesn't hold with the current order.