
Hi,
On Tue, Jun 17, 2008 at 2:43 PM, Matthias Vallentin
corresponding thread. How can deal with blocking functions, such as a calls to accept() or when a thread is waiting on a condition variable
FWIK, there is no way to get out of blocking calls elegantly. The way to go about it is to use non-blocking calls. Wait for multiple objects (on windows I have used this) where one of the object is an event. On an interrupt, you set the event and the wait will return. For 'select', SAMBA has a neat trick. They create a pipe, the select call also listens on one end of this pipe. On a signal, the signal handler writes a char to the pipe which makes the call to select return. For non-blocking accept, you could check the SAMBA implementation of socketpair. In a single thread, they create a socket, bind, accept, connect and return the pair of connected sockets. -dhruva -- Contents reflect my personal views only!