3 ms·
I realise this was just a quick example, but just to be clear, the latch is tied to the number of work items not the number of threads. If you had a thread pool
by quietbritishjim 5y ago
I realise this was just a quick example, but just to be clear, the latch is tied to the number of work items not the number of threads. If you had a thread pool (or single thread) with a queue, you can happily push any number of work items on to it and use the latch to wait until they're all complete, regardless of which threads they're handled in (or even if the jobs are interleved with other jobs from some other source).
- signa11 5y agoyes ofcourse!