On 05.03.2012 16:46, Regan Heath wrote:
A more efficient approach is to use async socket routines and an event
object.

So, in main you create a shared event object, then start the listen thread.
In listen you call an async select or accept, and then wait on that
/and/ the shared event object.

To stop listen you set the shared event, which wakes it, and it notices
the event is set and performs the cleanup/stops itself.

I'm not sure if phobos has support for this sort of thing yet, but you
could always leverage the underlying C library. I may be able to offer
some pointers on Windows, but I haven't done something like this on any
unix platform for a while..


Yeah, the main problem with event systems & async I/O is they are not cross-platform at all. And looking at linux even across one OS. To wrap them sanely on all platforms is no trivial task. I wish we had it in phobos though.

--
Dmitry Olshansky

Reply via email to