I am looking to use std::binary_semaphore
to make sure that threads are processed in the order in which they entered the semaphore.
I know that semaphore queues are typically FIFO, but I am not able to guarantee that C++'s implementation is FIFO.
Is the C++ std::binary_semaphore
FIFO? In other words, does it wake threads in the order in which they came in?
acquire
, how would you observe which one came first? On libstdc++,binary_semaphore
seems to be using futex, which does not provide any guarantee regarding which thread gets waken up on release. – MarleeWaitOnAddress
API, which is nearly FIFO. – Carlicarlicksched_setscheduler(SCHED_FIFO)
– Marlee