UnboundedQueue: Fix advanceHead
authorMaged Michael <magedmichael@fb.com>
Sat, 16 Dec 2017 17:48:36 +0000 (09:48 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 16 Dec 2017 17:51:08 +0000 (09:51 -0800)
commit124efa238dc51b331457c940e17aa9cb7c47a92e
tree0a8777a1e9e41c33d8e12d98855639fa0377e163
parentca3dd9ce41c991e36f34f86b018d73077f4a509c
UnboundedQueue: Fix advanceHead

Summary:
Without the fix multiple consumers may update head concurrently and cause it to lag. If this persists until the destruction time of the queue, some segments may be incorrectly retired twice.

The fix is to wait for head to advance to the current segment first before advancing head to the next segment.

Reviewed By: djwatson

Differential Revision: D6588135

fbshipit-source-id: 3e916441bff5ad3f27de418601990c59a0b89bc2
folly/concurrency/UnboundedQueue.h