Boost logo

Boost :

Subject: Re: [boost] [thread] A few submissions
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-07-04 16:11:15


Zitat von "vicente.botet" <vicente.botet_at_[hidden]>:

>> A few notes up-front. There are extensions in some compilers for TLS
>> support. It offers even better performance and easier to use. Also,
>> C++0x will bring this feature into the language. But:
>> * It is known to have problems with dynamically-loaded modules.
>> * It is not portable. Even when C++0x it out, not all compilers will
>> support it right away.
>> * thread_specific does not require the variable to have a static storage
>> duration.
>
> Stefan Stasser has proposed a stati_thread_specific_ptr (see
> attached file). What about a static_thread_specific that could be
> implemented using the C++0x thread_local, when available?

I use a static_thread_specific_ptr in namespace detail because I only
needed static TSS, but I don't propose adding this as a public
interface to boost.
a better implementation of the existing thread_specific_ptr interface
can be almost as efficient as static_thread_specific_ptr. there is one
additional indirection (two in the prototype implementation), but it
is just as efficient as thread_local otherwise.

static_thread_specific_ptr:
https://svn.boost.org/svn/boost/sandbox/transaction/boost/transact/detail/static_tss.hpp

efficient thread_specific_ptr prototype:
http://www.boostpro.com/vault/index.php?action=downloadfile&filename=tss.hpp&directory=&

pretty severe bug it also fixes:
https://svn.boost.org/trac/boost/ticket/3837


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk