Boost logo

Boost :

Subject: [boost] [threads] Unexpected behaviour of Thread loal storage
From: Fu ji (fujimailing_at_[hidden])
Date: 2015-04-29 03:07:57


I would like to ask if there is everything ok with my way of thinking.

I have 3 solutions (projects) in MS Visual Studio.

Let say:

SolutionA (static lib)
SolutionB (linked with Solution A)
SolutionC (linked with Solution A)

In Header file of solutionA I have delaration of TLS from boost

static boost::thread_specific_ptr<int> TLS;

And now in SolutionB I set tls (TLS.reset(uVariable)) - uVariable is
integer 2

Call function from SolutionC and call TLS.get() but there is different
value than 2.

But when i return from function to SolutionB and call TLS.get there is
everything ok (return 2).

It's ok ? Why in solutionC there is no visibilty of value set in solutionB
? It's the same thread (with the same threadId).

Best regards

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