* DCE/Posix threads
@ 1993-07-16 0:59 Dirk Grunwald
0 siblings, 0 replies; 7+ messages in thread
From: Dirk Grunwald @ 1993-07-16 0:59 UTC (permalink / raw)
I need to know how DCE/Posix threads access per-pthread information.
On our KSR-1, there is a compiler directive '__private' that lets me
indicate a copy of that variable should be allocated for each pthread
that is created. There is no such directive on our DEC AXP 3000/400.
In the DCE environment, I'm beginning to suspect that you must depend
on the intial argument value passed into the thread. Is this the case?
Any examples would be helpful.
Thanks,
Dirk Grunwald Asst. Prof, Univ. of Colorado at Boulder
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <1993Jul16.010227.13204@colorado.edu>]
* DCE/Posix threads
@ 1993-07-16 1:04 Dirk Grunwald
0 siblings, 0 replies; 7+ messages in thread
From: Dirk Grunwald @ 1993-07-16 1:04 UTC (permalink / raw)
I need to know how DCE/Posix threads access per-pthread information.
On our KSR-1, there is a compiler directive '__private' that lets me
indicate a copy of that variable should be allocated for each pthread
that is created. There is no such directive on our DEC AXP 3000/400.
In the DCE environment, I'm beginning to suspect that you must depend
on the intial argument value passed into the thread. Is this the case?
Any examples would be helpful.
Thanks,
Dirk Grunwald Asst. Prof, Univ. of Colorado at Boulder
^ permalink raw reply [flat|nested] 7+ messages in thread
* DCE/Posix threads
@ 1993-07-16 0:54 Dirk Grunwald
1993-07-16 8:45 ` Simon Patience
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Dirk Grunwald @ 1993-07-16 0:54 UTC (permalink / raw)
I need to know how DCE/Posix threads access per-pthread information.
On our KSR-1, there is a compiler directive '__private' that lets me
indicate a copy of that variable should be allocated for each pthread
that is created. There is no such directive on our DEC AXP 3000/400.
In the DCE environment, I'm beginning to suspect that you must depend
on the intial argument value passed into the thread. Is this the case?
Any examples would be helpful.
Thanks,
Dirk Grunwald Asst. Prof, Univ. of Colorado at Boulder
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: DCE/Posix threads
1993-07-16 0:54 Dirk Grunwald
@ 1993-07-16 8:45 ` Simon Patience
1993-07-16 12:17 ` Neil Winton
1993-07-16 22:58 ` Greg Brail
2 siblings, 0 replies; 7+ messages in thread
From: Simon Patience @ 1993-07-16 8:45 UTC (permalink / raw)
In article <GRUNWALD.93Jul15185451@frob.cs.colorado.edu>, grunwald@frob.cs.colorado.edu (Dirk Grunwald) writes:
> I need to know how DCE/Posix threads access per-pthread information.
DCE threads are 1003.4a Draft 4 based I believe.
There are three calls to manage thread specific data.
pthread_keycreate(pthread_key_t *key,
void (*destructor)(void *));
pthread_get_specific(pthread_key_t *key,
void **value);
pthread_set_specific(pthread_key_t *key,
void *value);
The key can be set up at any time and is usable by any thread. Threads
then associate any value they wish to the key, which will be stored in per
thread way by the threads library. You can create a number of these keys.
The pthread_get_specific() interface has changed slightly in later drafts
to return the value rather than storing it the location indicated by the
parameter, but this will not be implemented yet.
> On our KSR-1, there is a compiler directive '__private' that lets me
> indicate a copy of that variable should be allocated for each pthread
> that is created. There is no such directive on our DEC AXP 3000/400.
While the __private key may seem very useful, you will have noticed that it
doesn't lead to portable code.
Simon.
--
Simon Patience
Open Software Foundation Phone: +33-76-63-48-72
Research Institute FAX: +33-76-51-05-32
2 Avenue De Vignate Email: sp@gr.osf.org
38610 Gieres, France uunet!gr.osf.org!sp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: DCE/Posix threads
1993-07-16 0:54 Dirk Grunwald
1993-07-16 8:45 ` Simon Patience
@ 1993-07-16 12:17 ` Neil Winton
1993-07-16 22:58 ` Greg Brail
2 siblings, 0 replies; 7+ messages in thread
From: Neil Winton @ 1993-07-16 12:17 UTC (permalink / raw)
In article <GRUNWALD.93Jul15185451@frob.cs.colorado.edu>, grunwald@frob.cs.colorado.edu (Dirk Grunwald) writes:
|>
|>
|> I need to know how DCE/Posix threads access per-pthread information.
|> On our KSR-1, there is a compiler directive '__private' that lets me
|> indicate a copy of that variable should be allocated for each pthread
|> that is created. There is no such directive on our DEC AXP 3000/400.
|>
|> In the DCE environment, I'm beginning to suspect that you must depend
|> on the intial argument value passed into the thread. Is this the case?
|> Any examples would be helpful.
Sorry I don't have an example to hand, but you should look at the routines
pthread_keycreate(), pthread_setspecific and pthread_getspecific(). These
routines allow "per thread global" information to be stored and retrieved.
Basically you create a key (which is shared by all threads) and then associate
specific data with it on a per-thread basis. So you effectively have a key which
"means the same thing" to each thread, but which has a different value for each
thread. This seems pretty much the semantics of __private you describe above.
|> Thanks,
|> Dirk Grunwald Asst. Prof, Univ. of Colorado at Boulder
I haven't used this, so it is just my understanding of the documentation, but I
hope it helps.
Neil
* Neil Winton G306a, SSTF Building This sentence *
* N.Winton@axion.bt.co.uk BT Laboratories has two missing, *
* Tel +44 473 646079 Martlesham Heath but you can still *
* Fax +44 473 643019 IPSWICH IP5 7RE, UK sense of it. *
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: DCE/Posix threads
1993-07-16 0:54 Dirk Grunwald
1993-07-16 8:45 ` Simon Patience
1993-07-16 12:17 ` Neil Winton
@ 1993-07-16 22:58 ` Greg Brail
2 siblings, 0 replies; 7+ messages in thread
From: Greg Brail @ 1993-07-16 22:58 UTC (permalink / raw)
In article <GRUNWALD.93Jul15185451@frob.cs.colorado.edu> grunwald@foobar.cs.colorado.edu writes:
>
>I need to know how DCE/Posix threads access per-pthread information.
>On our KSR-1, there is a compiler directive '__private' that lets me
>indicate a copy of that variable should be allocated for each pthread
>that is created. There is no such directive on our DEC AXP 3000/400.
Of course, every thread has its own stack, although I don't think
that's what you mean.
There's also the pthread_setspecific function, which associates some
arbitrary data (i.e. a pointer) with a key on a thread-specific basis.
This, eash thread can access some private data via that key.
So if I define a "private" global variable on the KSR-1, will the
system automatically give each thread a private copy of that variable?
Pretty cool.
greg
--
Greg Brail ------------------ Citibank -------------------- gjb@fig.citib.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1993-07-16 22:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-07-16 0:59 DCE/Posix threads Dirk Grunwald
[not found] <1993Jul16.010227.13204@colorado.edu>
1993-07-16 1:11 ` Dirk Grunwald
-- strict thread matches above, loose matches on Subject: below --
1993-07-16 1:04 Dirk Grunwald
1993-07-16 0:54 Dirk Grunwald
1993-07-16 8:45 ` Simon Patience
1993-07-16 12:17 ` Neil Winton
1993-07-16 22:58 ` Greg Brail
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox