Subj : Re: pthreads: cancelling thread blocked on berkeley socket accept() To : comp.programming.threads From : David Schwartz Date : Tue Sep 20 2005 10:06 pm "Missaka Wijekoon" wrote in message news:R14Ye.44163$ct5.32765@fed1read04... > You could poll() the socket with a timeout before calling accept. If you > get a POLLIN event, then accept(). If you get a timeout on the poll, > check the shutdown flag and if set, gracefully exit. That should be safe provided two things: 1) You set the socket non-blocking. 2) You let the poll/accept thread close the socket. (Or the main thread after it joins the poll/accept thread.) DS .