Question

gcc 4.7.2
c89

Hello,

I am using the APR safe thread queue in the utils library. My design is to use a thread to push a message to the queue and another thread to pop a message from the queue. This part is ok using apr thread pool and memory pools.

However, I want to block until there is something to pop from the queue. I want to use a semaphore to indicate there is something to pop from the queue. However, I could not see any semaphores in the APR-Utils.

I can use the posix semaphores but I would rather go with something more portable. As I am using APR would rather stick with that.

Does APR have semaphores, I could not see any?

Many thanks for any suggestions,

Était-ce utile?

La solution

apr_queue_pop blocks if queue is empty, so there is no need for semaphores.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top