|
Boost Users : |
Subject: [Boost-users] BoostTest: Is BOOST_MESSAGE is not thread safe?
From: Dmytro Ovdiienko (dmitriy.ovdienko_at_[hidden])
Date: 2010-03-23 16:28:49
Guys,
I've just noticed BOOST_MESSAGE is not thread safe instruction.
It is unbelievable!! I do not want to believe it!!!
Try this:
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/thread/thread.hpp>
void foo()
{
for( size_t i = 0; i < 100000000; ++i )
{
BOOST_MESSAGE( "111111122222222223333333333" );
}
}
BOOST_AUTO_TEST_CASE( testBoost )
{
size_t const SIZE = 2;
boost::thread t[ SIZE ];
for( size_t i = 0; i < SIZE; ++i )
{
t[ i ] = boost::thread( &foo );
}
for( size_t i = 0; i < SIZE; ++i )
{
t[ i ].join();
}
}
windows XP SP3 32bit
VS 2008 SP1
boost 1.42
-- Dmytro Ovdiienko
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net