I am trying to use libev for event based programming. But there are some events provided by libev like EV_READ, EV_WRITE, EV_TIMER ..
So, is it possible to have an custom event of my own.
For instance, I have a continuous flow of messages from a socket an I am interested in only a type of message in that stream of messages. So, its basically like
while(true)
{
Msg msg = getMessage();
if(msg != null && msg.id == ourId)
return msg;
}
So, I want to register for events of this sort (only that if
condition is satisfied.) . Its a custom event right ? How do I specify this event to libev.
I mean in libev we specify like this ..
ev_io_init (&stdin_watcher, stdin_cb, /*STDIN_FILENO*/ 0, EV_READ);
ev_io_start (loop, &stdin_watcher);
I dint see any stuff where we can check for our own events. Is it possible ?