How do I use poll()?

Poll() in UNIX is used for to wait for some event on a file descriptor. When poll() is used, the user must allocate an array of pollfd structures, and pass the number of entries in this array.



The parameter fd is a file descriptor to open the file while timeout is in milliseconds. If the timeout value is negative, it means negative timeout. The structure if the is as below:



How do I use poll()?
poll() allows an event to wait on a file descriptor. A pointer is accepted by poll() to a list of ‘struct pollfd’. A bitwise mask is used to specify the events in the field of events of the structure. The structure’s instance will be filled at a later point of time and returns with events that were occurred.

The struct pollfd has the following format

No comments:

Post a Comment

The advantages of Outsourcing Web Development Services

In the present digital world, acquiring a solid web presence is essential for companies to flourish. A well designed site is much much more ...