httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <>
Subject Re: Which thread/process
Date Thu, 12 Aug 1999 15:45:10 GMT

In article <> you wrote:
>> > Okay, we took out the only place in the 2.0 tree where we designated a
>> > unique number for each thread within each process.  Namely, the
>> > thread_num/child_num pair in the conn_rec.  So how am I now supposed to
>> > get a deterministic value for the exact thread I am running in?
>> Pthreads has a pthread_self() function which you perhaps want to use.  Or you
>> can use TSD and save there a unique number at thread creation time.
> Sorry, I should have mention this.  I would rather not use pthread_self if
> I can help it.  Because going that route means I have to call both
> getpid() and pthread_self() EVERY time a cgi is requested.  This can get 
> expensive quickly.

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.

> Sorry, but I don't know what TSD is.

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

                                       Ralf S. Engelschall

View raw message