Boost logo

Boost :

From: Johan Nilsson (johan.nilsson_at_[hidden])
Date: 2004-07-30 05:08:40

"Roland" <roland.schwarz_at_[hidden]> wrote in message
> On Wed, 28 Jul 2004 13:25:21 +0100 John Maddock <john_at_[hidden]>
> > I agree, and it should be able to clean up non-boost threads as well -
> > consider what happens if you're writing a library, and not a program -
> > then have no control over who creates threads or how they do so. I
> > it would be unacceptable to say "you can only use this library if you
> > use Boost.Threads"; in such cases thread_specific_ptr is exceptionally
> > useful IMO.
> While having heard this argument quite often, I still do not understand
how this
> can ever work (in a reliable way).
> Say you have a peace of code located in module A that is starting a thread
> whatever means (System thread e.g.).
> Now in your module B you have a (global) TSS variable.
> A calls into B.
> When should the TSS be initialized? On first use? I am afraid that is not
> possible, since you (as far as I understand on WIndows) will need to
> acquire a slot for this variable when the process starts up (normally in

You can do it at any time. The MSDN docs only say "TLS indexes are
_typically_ allocated during ... intialization.".

// Johan

Boost list run by bdawes at, gregod at, cpdaniel at, john at