MCPcopy Create free account
hub / github.com/YACReader/yacreader / cancelPending

Method cancelPending

common/concurrent_queue.cpp:46–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46std::size_t ConcurrentQueue::cancelPending()
47{
48 decltype(_queue) oldQueue;
49 {
50 const std::lock_guard<std::mutex> lock(queueMutex);
51 // The mutex locking time is lower with swap() compared to assigning a
52 // temporary (which destroys _queue's elements and deallocates memory).
53 _queue.swap(oldQueue);
54 }
55
56 const auto size = oldQueue.size();
57 if (size != 0)
58 finalizeJobs(size);
59 return size;
60}
61
62void ConcurrentQueue::waitAll() const
63{

Callers 3

cancelAndPrintFunction · 0.80
createModelDataMethod · 0.80
createModelDataMethod · 0.80

Calls

no outgoing calls

Tested by 1

cancelAndPrintFunction · 0.64