Io watchers check whether a file descriptor is readable or writable in each iteration of the event loop, or, more precisely, when reading would not block the process and writing would at least be able to write some data. This behaviour is called level-triggering because you keep receiving events as long as the condition persists. Remember you can stop the watcher if you don’t want to act on the event and neither want to receive future events.
In general you can register as many read and/or write event watchers per fd as you want. Setting all file descriptors to non-blocking mode is also usually a good idea (but not required).
Another thing you have to watch out for is that it is quite easy to receive ‘spurious’ readiness notifications, that is, your callback might be called with EV_READ but a subsequent read() will actually block because there is no data. It is very easy to get into this situation even with a relatively standard program structure. Thus it is best to always use non-blocking I/O: An extra read() returning EAGAIN is far preferable to a program hanging until some data arrives.
If you cannot run the fd in non-blocking mode, then you have to separately re-test whether a file descriptor is really ready with a known-to-be good interface such as poll. Some people additionally use SIGALRM and an interval timer, just to be sure you won’t block indefinitely.
But really, best use non-blocking mode.
Configures the watcher.
The file descriptor being watched.
The events being watched.