What happens internally when event_base_dispatch( )
function is called? Are there any threads that are created which keep running until some signal to stop is received?
Asked
Active
Viewed 5,666 times
2

xennygrimmato
- 2,646
- 7
- 25
- 47
1 Answers
4
event_base_dispatch()
is a blocking call which executes your defined callbacks inside a loop in the thread that calls the function. It continues to run until there are no more registered events or you call event_base_loopexit()
/ event_base_loopbreak()
.
See http://www.wangafu.net/~nickm/libevent-book/Ref3_eventloop.html
It is equivalent to event_base_loop(event_base, 0)
. After taking a quick look at the source code, I don't see any other threads created:
https://github.com/libevent/libevent/blob/master/event.c#L1847

1000ml
- 864
- 6
- 14