Boost logo

Boost :

From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2007-03-05 07:13:29


Hi,

I don't know if this is a known bug or not:

When using thread_specific_ptr's, if at any time later in the program the
total tss data items drops to zero, it is no longer possible to use tss
data. Example:

-----------------
#include <boost/test/minimal.hpp>
#include <boost/thread/tss.hpp>

using namespace boost;

int test_main(int, char*[])
{
 {
  thread_specific_ptr<int> pi;
 }

 try
 {
  thread_specific_ptr<int> pi;
 }
 catch (thread_resource_error&)
 {
  BOOST_FAIL("Can't use TSS any longer after initial usage dropped to
zero!");
 }

 return 0;
}
---------------------

The above program fails when using Boost from the RC_1_34_0 branch + msvc
8.0 under XP SP2 (my copy of the 1.34 branch is not very recent - from
January this year). Haven't tried other combinations.

The actual problem seems to be related to tss deinit based on reference
counting and init based on once_init, IIUC.

Best regards,

Johan Nilsson


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