Search code examples
pthreadslibevent

pthread adds a socket to libevent but exits


Is it undefined behavior, if a pthread adds a fd to libevent (event_new -> cbk()) but terminates ? I see that the cbk() gets invoked on EV_READ!


Solution

  • no it is not undefined behavior.

    As long as the process where libevent base is created and dispatch function is invoked is running as expected. cbk() should be invoked on EV_READ.