Why can't I get this two-way ev_async example to work?

Åke Kullenberg ake.kullenberg at gmail.com
Fri Nov 22 15:04:38 CET 2013


I have attached a very simple ev_async example where I start one event
loop, and another loop in a thread. Both loops contain an async watcher.
When this watcher receives an event, a timer is kicked off. When the timer
fires, an async event is sent the other way. Hence I would expect these two
to bounce off each other indefinitely.

However when I run the program the slave thread's call to ev_async_send
doesn't seem to register. The callback to master_cb_async is never invoked.

$ bin/async
main - starting loop
    slave_loop - starting loop2
master_cb_timeout - sending async_send to loop2
    slave_cb_async - received async_send starting timer for loop2
    slave_cb_timeout - sending async_send to loop

Why doesn't this ev_async_send register? What am I doing wrong? If If this
is a clear case of RTFM just point me in the right direction. If not, I'd
appreciate some help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20131122/5f7edaee/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: async.c
Type: text/x-csrc
Size: 2298 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20131122/5f7edaee/attachment.c>


More information about the libev mailing list