From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,155d3ba1d18bbef7 X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-08-25 10:45:32 PST Path: gmd.de!xlink.net!howland.reston.ans.net!spool.mu.edu!bloom-beacon.mit.edu!paperboy.osf.org!rsalz From: rsalz@osf.org (Rich Salz) Newsgroups: comp.unix.osf.misc Subject: Re: DCE, multithreading & pthread_self() Date: 25 Aug 1993 17:30:49 GMT Organization: Open Software Foundation Message-ID: <25g7k9$3ss@paperboy.osf.org> References: NNTP-Posting-Host: sulphur.osf.org In 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$