View Single Post

   
  #6 (permalink)  
Old 02-16-2008, 07:03 AM
William Ahern
 
Posts: n/a
Default Re: Does OpenBSD understand the __thread variable declaration ?

Jack <jhammer.noemail@yahoo.com> wrote:
> llothar wrote:
> > Okay so i have to remove OpenBSD from the list of possible supported
> > systems.
> > Bad. It's a perfect good extension to the 20 year old pthread standard.
> >
> >
> > But maybe BSD likes to be "State of the Art" of 1985.
> > Multithreading was always weak but now with all the dual cores it
> > really starts to hurt.
> >

> The "__threading" keyword has nothing to do with the OS that it is running on;
> it has to do with the compiler that you are using. So, if you have the right
> compiler for each platform, then you should not have a problem.


As far as I understand TLS (thread local storage), what's required is
compiler, linker and library cooperation. Which is why the support isn't
wide spread; there's lots of platform retooling required to get TLS
implemented. Linux only got it recently, in fact.

> However, I would follow Marco's suggestion to stick with the POSIX
> standard on unix and don't use it.


TLS is extremely useful. Had it been required when POSIX Threads debuted we
could have sidestepped a decade of kludgy _r library extensions and
countless coredumps and exploits. Unfortuantely, TLS isn't widely supported.
AFAIK, only [recently released versions of] Linux and Solaris provide
support. FreeBSD might be close if they don't have it already.

In any event, I have to concur that to be portable by any streth of the term
you need to stick to getspecific()/setspecific().

OpenBSD would probably be last since the team doesn't care to add fancy
features to the linker, and pthreads support is still on the move.
Reply With Quote