[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ProgSoc] POSIX pthreads



Hi!

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?

Thanks!


 Greg Kopff
===================================================
gkopff@nospam.powersource.com.au      PowerSource Software
          http://www.powersource.com.au
 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 progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.