Subj : pthreads: cancelling thread blocked on berkeley socket accept() To : comp.programming.threads From : Luke Dalessandro Date : Mon Sep 19 2005 04:38 pm I have a thread running on a listen()->accept()->spawn_job()->listen() loop on a socket (unix/berkeley). I have the socket set to block on the accept(). spawn_job() dispatches a thread to handle the incoming request. When the application is shut down, I want to cancel the thread and close() the socket. Is it appropriate to call pthread_cancel() on a blocked thread? If I call pthread_cancel(listener) and then pthread_join(listener) from the main (parent) thread, am I guaranteed that it is safe to close() the socket? Thanks in advance, Luke .