Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2005-01-17 17:54:56


Hartmut Kaiser wrote:

>Could you provide a patch?
>
>
>
As you know: It is easy to suggest a solution if you know nothing about
the problem.

And I definitely do not know enough about spirit.
To be precise: I have no idea how the *.ipp is getting into play.
So please understand that I am only showing a way:

Say you have:

void foo() {
    static boost::thread_specific_ptr<mytype> p;
    p->myval;
}

I suggest instead to have something along the lines:

namespace { // to keep things private as possible
    boost::thread_specific_ptr<mytype> foo_p;
};
void foo() {
    foo_p->myval;
}

Since I expect, that it will be not of much difference if you put the
tss into anonymous namespace this should force the ctor beeing
called once before main. The point is that thread_specific_ptr
needs to be a global object.

Does this help?

Roland


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