Execute code immediately after watcher callback function returns

Thilo Schulz thilo at tjps.eu
Mon Sep 10 15:36:07 CEST 2012


Hello,

thank you for maintaining libev, it is a great piece of software, and I've 
used it in numerous applications already.

Now to my question:
I have a module loaded that will be woken up by a watcher, and the module is 
supposed to signal itself to the program, when it can be unloaded. For obvious 
reasons, I cannot unload the module directly from the module itself or the 
callstack gets corrupted.

So, I'd like to "inject" the execution of code immediately after the callback 
function from the watcher has returned.

I had two possibilities in mind: Add an ev_prepare watcher that unloads the 
module before next loop interation, or add an idle watcher with high priority 
from the module itself (does this work at all?).

However, the first possibility does not unload the module immediately, but 
only when all other watchers have finished processing, and the second 
possibility seems rather hackish to me.

That's why I'd like your opinion on this. Please add me to the CC, because I'm 
not subscribed to the mailing list.

-- 
All the best,
Thilo Schulz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20120910/9b26be02/attachment.pgp>


More information about the libev mailing list