[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Q: Exception callbacks and events that should run immediately



Hi!
Â
1) I don't see any notion of event notification on FD exception - e.g. socket close.
  There are some words for buffer events, but nothing for regular file
  descriptor based callbacks. So what is a good way to get a callback when specific
  FD is closed/disconnected?
Â
If the fd is a socket and the peer closes then you'll get a read callback. When you read from the fd 'read' will return 0 indicating that the peer closed.
Â
Â


2) Sometimes I need to post an event that will be executed in the same event loop iteration
  (possibly after other events are processed)- e.g. ÂI want to break a long call stack and restart
  from the event loop or want to give other events a chance to run. What is the good way of doing this -
  should I just post a timer event with a zero timeout value or do something else?

Â

Not sure.
Â