Semaphore for UDP socket
Hi all,
I'd like to know if it's possible to have the following behaviour with a UDP socket.
1. Have a thread waiting for data to read on the socket.
2. Increase a semaphore each time a new packet arrives.
3. Have another thread waiting on the semaphore and reading one and only one packet for each count of the semaphore.
The problem with select is that it wakes up as long as data is available for reading, and not only when a new packet arrives.
Can epoll help me in doing that (I can't figure out from the man pages)?
Thanks.
|