News for hackers. Stuff that matters.
Re:Latches in C++20 by varajelle on Wednesday January 27, 2021 @02:36AM (#25925363)
What's the difference with a semaphore?
Re:Latches in C++20 by giu on Wednesday January 27, 2021 @04:40AM (#25926152)
A semaphore can be used to control thread access to a resource.

A latch allows one or more threads to wait until a set of operations being performed in other threads completes [0].

[0] https://docs.oracle.com/javase/8/docs/api/java/util/concurre...

Re:Latches in C++20 by magicalhippo on Wednesday January 27, 2021 @04:47AM (#25926191)
A semaphore allows threads to pass until the counter reaches zero.

A barrier (what this thing is) blocks threads until the counter reaches zero.