Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-07-28 03:17:20


Roland wrote:

> I don't think so. The purpose of TSS variables is to be global to your namespace.
> Member variables are not. To access them you would need some pointer,
> possibly declared globally. To access this pointer in turn one again needs to
> resort to TSS.

Possibly, but not necessarily. In C++ we tend to replace global
variables with singletons. In case of thread object we could have class
having single instace per thread ("thread singleton") and static member
function returning instance for current thread ("thread accessor"). This
instance does not need to be stored on thread local storage. It can be
stored in global table (simplest option would be to use thread IDs as
table index), thus still available after thread destruction (eg. for
deterministic destruction and pulling results).

B.


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