concurrentqueue icon indicating copy to clipboard operation
concurrentqueue copied to clipboard

BlockingConcurrentQueue How do I delete all tasks

Open jackwxs opened this issue 2 years ago • 2 comments

jackwxs avatar May 04 '23 01:05 jackwxs

Dequeue them all.

If you know the queue is not being accessed concurrently by other threads, you can also start fresh like so:

ConcurrentQueue<int> q;
...
q = ConcurrentQueue<int>();

cameron314 avatar May 04 '23 14:05 cameron314

I see the ~ConcurrentQueue() destructor that performs a variety of clean-up tasks, so this makes sense to me.

randolf avatar May 15 '23 21:05 randolf