You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no simpler way, I'm afraid. Adding a clear() method would require coordination between all producers, which can't be done efficiently with the current design; so, it's up to the user to do such coordination.
Your loop is efficient, and correct assuming that no more tasks are being added in parallel, and that the thread it's running on has been synchronized with all the producer threads after their last enqueue operation (e.g. via a memory barrier or mutex).
Hello.
At some point in the code I want to clear the queue for potential reuse. I'm using:
Is there any other (simpler, more correct) way to clear the queue or discard the elements currently enqueued?
Thanks.
The text was updated successfully, but these errors were encountered: