Hi,

the manual says:
    Just remember to unref after start and ref before stop.

I have a different use-case where this doesn't apply and would like to
know if you can spot any flaw in it (it seems to be ok but who knows?).

I use libev as the underlying event loop for a library of lightweight,
cooperative, (continuation-based) threads. These threads might be
"detached", i.e. executed in a native thread pool, and reattached.

I use an async watcher to wake up the main loop upon reattaching, and
unref this watcher as explained in the manual to prevent it from
blocking the termination. But I also don't want the loop to end when
every thread is detached, so I ref when detaching and unref when
attaching a thread.

Does it sound right? Could I get a busy wait when everybody is detached
or does the async watcher handle that case nicely?

[Completely unrelated: I'm a bit concerned that libev includes external
headers. I worked around this by disabling the stats and defining
EV_ATOMIC_T. Do you have a list of architectures where sig_atomic_t !=
int?]

TIA,
regards,
-- 
Gabriel

_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to