Hi, experts,

is there a fundamental reason, why sd-event doesn't provide functions to update 
the handler of an existing event source, e.g.

    int sd_event_source_set_io_handler(sd_event_source *source, 
sd_event_io_handler_t handler);

and similar for the other event types?

I think, it could be useful. For example, when a protocol on network connection 
goes through different states, this could be tracked by exchanging the handler. 
Example of such protocol state could be before and after ssl handshake 
(SSL_accept()) is done.

If you can't exchange the handler, you need to keep such state in a *userdata 
context object. With that, the singleton multi-purpose handler tends to mutate 
into a ugly state machine. And if that state is the only thing you need the 
*userdata for, you might be able to avoid the individually malloced object 
completely, if you can keep the state somewhere else.

Exchanging the event source would probably also work, but it has a lot more 
overhead.

Best
  Donald
--
Donald Buczek
buc...@molgen.mpg.de
Tel: +49 30 8413 1433

Reply via email to