ev_timer_start() appears to not wake up loop from epoll_wait()

Chris Zahka czahka at gmail.com
Fri Apr 10 23:20:33 CEST 2015


Hello,

I hope this message finds you well.

The following issue is likely self-inflicted but it is not clear how at
this point.

The attached test code is a program that runs with two threads (the main
thread and a child pthread).

The main thread:
1. Initializes the child event watchers (one async, one timer)
2. Calls pthread_create() which results in the ev_run() executing in the
child thread
3. calls ev_timer_start() with a value of 0.5 seconds
4. sleeps for several seconds, to ensure that the child thread will get
called

Note: I typically use pthread conditionals to ensure that an event on
another thread gets executed.

The child thread:
1. After the ev_timer_start() is called it *should* wake up 0.5 seconds
later, printing out a message showing that the callback has occurred

What I see happening, instead of waking up 0.5 seconds later, is it takes
roughly 60 seconds for the timer to start going off. I put some debug in
the ev.c code and determined that within the ev_run() function, the
waittime getting passed to backend_poll was 59.793 seconds.

It appears as though ev_timer_start() does not cause the backend_poll to
wake up. Is this the expected behavior or am I doing something wrong?

I have also attached the config.log file so you can see the architecture
where I am having problems. Note that I also tried the same program on a
x64 system with the same results.

Thanks very much for your time.

Regards,

Chris Zahka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20150410/908df675/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log
Type: application/octet-stream
Size: 36879 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20150410/908df675/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libev_timer_test_plain.c
Type: text/x-csrc
Size: 3150 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20150410/908df675/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 326 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20150410/908df675/attachment-0003.obj>


More information about the libev mailing list