Subj : Re: pthreads: cancelling thread blocked on berkeley socket accept() To : comp.programming.threads From : David Schwartz Date : Mon Sep 19 2005 12:35 pm "David Hopwood" wrote in message news:KmBXe.865$MD4.78@fe1.news.blueyonder.co.uk... > You should set a shared 'shouldExit' flag and close() the socket from the > main thread. The listening thread will get an error from the accept(), and > can then exit when it sees that 'shouldExit' is set. Note that this is a very dangerous thing to do and should only be done as part of a shutdown process. It can cause terrible corruption. Hint: How can you be 100% sure the other thread is actually in 'accept' as opposed to *about* to call 'accept' but not in it yet? DS .