From: rsalz@osf.org (Rich Salz)
Subject: Re: DCE, multithreading & pthread_self()
Date: 25 Aug 1993 17:30:49 GMT [thread overview]
Message-ID: <25g7k9$3ss@paperboy.osf.org> (raw)
In-Reply-To: CBSMITH.93Aug25112729@ccnga.watserv2.uwaterloo.ca
In <CBSMITH.93Aug25112729@ccnga.watserv2.uwaterloo.ca> cbsmith@ccnga.watserv2.uwaterloo.ca writes:
>I've hypothesized that the server does not generate a new thread ID for
>each RPC call it receives, but rather has a number of worker threads
>running all the time which receive RPC calls and execute them. Any calls
>beyond the limit imposed by DCE (presumably matching the number of
>worker threads) are placed in a queue.
This is 100% correct.
I'm not sure why you want unique ID's for each RPC call, but there are
a couple of things you can do. You first need to think about how you
are going to associate the ID with each RPC. You could attach it to
the thread, or you could keep it in some (global) per-operation state
table. To do the former, call pthread_keycreate before you call
rpc_server_listen, and then call pthread_getspecific and pthread_setspecific
to get and set your unique ID.
As for what to use for unique ID's there are two choices. A simple
increasing counter (protected by a mutex which must be initialized; easiest
to do before rpc_server_listen), or DCE uuid's.
>server code, but if I *did* (I am planning to) it would make the whole
>process even more confusing. (Is a new thread going to be handled by a
>worker thread [old thread ID], or is it going to generate an entirely new
>thread in the server [new thread ID]?)
I don't see how it is more confusing. If you need an application-specific
unique identifier, then you should use an application-specific kind of
thing. You really don't (want to) care whether threads are recycled or
not.
Hope this helps.
/r$
prev parent reply other threads:[~1993-08-25 17:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-08-25 15:27 DCE, multithreading & pthread_self() cbsmith
1993-08-25 17:30 ` Rich Salz [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox