Sorry I never responded (been buried). Unfortunately past the fact that
you can do "thread_specific()" I don't know much about what's available
for localized thread data.

                        - Matt

Terry Gin wrote:
> 
> Thanks, Matt.
> 
> Actually, I did mean thread-local storage, which is a language extension
> supported by some compilers.  These compilers probably use
> thread-specific data to implement thread-local storage.
> 
> I can use thread-specific data to accomplish what I want, but it's a
> little more "bulky."  With thread-local storage, I simply declare a
> global variable with a special attribute (e.g., __thread or
> __declspec(thread)).  Every thread gets its own copy.  To access a copy,
> the thread simply refers the it like any other global variable.
> 
> With thread-specific data, I have to call pthread_key_create() to create
> the variable and pthread_set/getspecific() to access it.
> 
> I was hoping g++ supported this extension as well.
> 
> If I do use pthread_key_create(), does my main() thread also get its own
> copy of the data, or only threads created by pthread_create()?
> 
> Thanks.
> 
> Terry
> 
> -----Original Message-----
> From: Matt Fahrner [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 26, 2001 3:19 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Thread-local storage
> 
> If you mean "thread specific" data then POSIX threads (pthreads) has
> "pthread_key_create()" and "pthread_setspecific()" to do so....
> 
> See the man for it.
> 
>                         - Matt
> 
> Terry Gin wrote:
> >
> > I'm porting an app that currently runs on both Win32 and HP-UX to
> Linux.
> > MSVC++ supports thread-local storage via the __declspec(thread)
> > attribute, and HP-UX's aCC supports it via the __thread attribute.
> Does
> > Linux (g++) have similar mechanism that supports thread-local storage?
> >
> > Thanks in advance.
> >
> > Terry
> >
> > _______________________________________________
> > Redhat-devel-list mailing list
> > [EMAIL PROTECTED]
> > https://listman.redhat.com/mailman/listinfo/redhat-devel-list
> 
> --
> ---------------------------------------------------------------------
> Matt Fahrner                                    2 South Park St.
> Manager of Networking                           Willis House
> Burlington Coat Factory Warehouse               Lebanon, N.H.  03766
> TEL: (603) 448-4100 xt 5150                     USA
> FAX: (603) 443-6190                             [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> 
> _______________________________________________
> Redhat-devel-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-devel-list
> 
> _______________________________________________
> Redhat-devel-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-devel-list

-- 
---------------------------------------------------------------------
Matt Fahrner                                    2 South Park St.
Manager of Networking                           Willis House
Burlington Coat Factory Warehouse               Lebanon, N.H.  03766
TEL: (603) 448-4100 xt 5150                     USA
FAX: (603) 443-6190                             [EMAIL PROTECTED]
---------------------------------------------------------------------



_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to