Closed ekpneo closed 12 years ago
The implementation all looks great, however I think the intention of async watchers is that they allow you to send an event to an event loop running in a separate thread... and lua-ev is definitely not thread safe. So, what is your use case for wanting async watchers?
Specifically, this is what the manual says:
http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_async_code_how_to_wake_up_an
"Sometimes, however, you need to wake up an event loop you do not control, for example because it belongs to another thread. This is what ev_async watchers do: as long as the ev_async watcher is active, you can signal it by calling ev_async_send, which is thread- and signal safe."
Thanks, -Brian
Since I've got no response, I'm going to close this pull request, but if you can explain your use-case a bit more, then I would be happy to reconsider.
Hello,
First off, thank you for these bindings! I implemented an initial version of Async watchers. It's pretty minimal, but should suffice for some use cases. I realized I needed something like this for another project.
The only thing I don't like is that you have to have a reference to the Async watcher (and loop) to trigger it. Would be nice to trigger the loop and have it trigger any Async watchers in it. But then, the C API requires both the Async watcher and the loop, so maybe it's ok as is.
In any case, let me know if it needs tweaking or is just total garbage. :P
Thanks! -Ted