
vicente.botet wrote:
What type of semaphore are you planning to have in your library?
Hi,
currently Synchro provides the same semaphore as Boost.Interprocess (counting semaphores), except that it uses Threads resources on a inter-threads context, and Interprocess resources on a inter-process context.
The library could provide binary semaphores (the difference is minimal).Could you talk us about your use case, and why a mutex cannot be used in your context?
I need to block a thread until either a timeout expires or some other thread wakes this one up. This is really what condition_variable::timed_wait() is for, right? Why can't condition_variable::timed_wait() be used? It can. It has a drawback, though. After the condvar was signaled it has to lock a mutex. This means there is an unbound timeout between the time condvar was signaled and the time condition_variable::timed_wait() returns. A binary_semaphore::timed_wait() can be used for the same purpose. The advantage is it doesn't have to lock a mutex. BR, Dmitry