threads: Waiting for event & shutdown socket

Sean Kelly sean at f4.ca
Wed May 30 14:32:29 PDT 2007


Benjamin Schulte wrote:
> Hi!
> 
> Just two other problems - now coming with threads.
> 
> First:
> Is there something like the WinAPI method 'WaitForSingleObject'?

Depends.  Thread.sleep() in Tango calls SleepEx(INFINITE,TRUE) on Win32, 
which will be interrupted when IOCP events occur and such.  For 
something more general I think you will probably want something like a 
condition variable.

> I've created a server socket in a thread. I set blocking to 'true' and now I'm waiting for connections in "accept()". Well, however it's possible that the thread should be closed while it's accepting. How can I cancel that waiting-for-users?

Why would the thread be closed while it's accepting?  Or did you mean 
the socket would be closed?


Sean



More information about the Digitalmars-d mailing list