poll(2) doesn't empty the event queue
- by sasayins
Hi,
Im using linux as my programming platform. I am using poll(2) to know if my device is triggering an event.
The first call of poll is ok, it blocks and wait for the event to happen. But in the second poll function call, it will return but it capture the event. Below are my code
ret = poll( fds, 1, 2000); //2 secs timeout
if( fds[0].revents & POLLIN && ret > 0)
{
printf("event occur\n");
}
It seems the queue/buffer is not empty, im just assuming.
What do you think is the problem?
Thanks.