httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@raleigh.ibm.com>
Subject Re: Which thread/process
Date Thu, 12 Aug 1999 16:38:58 GMT

> Hmmm... this depends on the OS and the the Pthread library, of course. For
> instance least for FreeBSD and Pth getpid() and pthread_self() are both _very_
> fast. The overhead of calling them is not more than that of the function call
> itself. But it can be different for others, ok. But you shouldn't worry about
> this in your situation, IMHO.

I just realized why getpid and pthread_self won't work.  Sorry, I new
there was a reason, but I couldn't think of what it was.  I do not want to
rely on these numbers.  I will be creating all of the pipes when the
server starts, because otherwise, I may as well fork the threaded process.
Therefore, I don't want to use pids, because I don't know what the old
pids were.  That is thoroughly confusing, but think of it this way:

Create first child    pid == 512
Create first thread   tid == 1
Create second thread  tid == 2

Create named pipes  pipe512a1 and pipe512a2

first child dies abnormally or normally.  pipes are sticking around,
because they have the same life span as the server.

second child is created to take first childs place   pid == 513

This child does not know it should be using the first child's pipes, so
everything is broken.

I need to have arbitrary values that I can assign to processes and threads
across the life of the server.  Basically, the child_num/thread_num data.

> TSD = Thread-Specific Data
> For Pthreads that's the pthread_key_t stuff.

I had a feeling that's what you meant, I know that as Thread Local Storage
or TLS.

I can use TLS to store the child_num/thread_num data, but why is this any
better than putting it in the conn_rec where it used to live?

Ryan

_______________________________________________________________________
Ryan Bloom		rbb@raleigh.ibm.com
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	



Mime
View raw message