Using libev in a GUI

Tim McClarren tim at
Wed Jan 6 02:29:15 CET 2010

I have had no problems using loops inside background threads.  Just 
create a new loop in that thread an ev_loop on it.

Using ev_async's to communicate between loops that are being pumped in 
different threads seems to work nicely.

Just use ev_loop_new to create a new loop, and then ev_loop on that 
newly created loop.  If you need to handle signals, you'll want to use 
the default loop though.

John Wright wrote:
> I need to embed a very simple server in a Mac carbon bundle that will be 
> loaded when a GUI starts up.  It can’t hang the main thread as the GUI 
> needs to start responding to user interaction.  So I can’t start an 
> ev_loop in the main thread.  Are there any examples of people starting 
> the ev_loop in another thread in this sort of situation?  I am not an 
> experienced C programmer and was just hoping to build a simple webserver 
> that will serve up one file.
> Thanks!
> John Wright
> ------------------------------------------------------------------------
> _______________________________________________
> libev mailing list
> libev at

More information about the libev mailing list