[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ProgSoc] POSIX pthreads
I am trying to build a so-called "concurrent" server process that accepts
TCP/IP connection requests from clients. The server is written in C on a
UNIX box and I'm using POSIX pthreads.
The main thread in the server creates a separate thread using
pthread_create() for each request that arrives. The very first thing a new
thread does is to detach itself using pthread_detach().
When the new thread has finished processing the request it terminates
itself using pthread_exit(). I only want this particular thread to exit,
but unfortunately, it looks like the whole server (i.e. all threads) exit
when pthread_exit() is called.
I was under the belief that when a "detached" thread exited, it didn't
cause any other threads in the same process to exit. Is this correct?
Where am I going wrong?
email@example.com PowerSource Software
Do you know that 'if' is the middle word in life?
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to firstname.lastname@example.org.
If you are having trouble, ask email@example.com for help.