D
daniele
I compiled the following code with mingw, but it crashes after some
seconds of execution.
Maybe the operator << with ptime is not thread safe?
I tried the same code with MS Visual C++ and it works.
#include <boost/thread.hpp>
#include <iostream>
#include <sstream>
#include <boost/date_time/posix_time/posix_time.hpp>
using namespace boost:osix_time;
void f()
{
while ( true )
{
std:stringstream os;
ptime t( second_clock::local_time() );
os << t;
}
}
int main( int argc, char* argv[] )
{
boost::thread t1( f );
boost::thread t2( f );
system( "PAUSE" );
return 0;
}
seconds of execution.
Maybe the operator << with ptime is not thread safe?
I tried the same code with MS Visual C++ and it works.
#include <boost/thread.hpp>
#include <iostream>
#include <sstream>
#include <boost/date_time/posix_time/posix_time.hpp>
using namespace boost:osix_time;
void f()
{
while ( true )
{
std:stringstream os;
ptime t( second_clock::local_time() );
os << t;
}
}
int main( int argc, char* argv[] )
{
boost::thread t1( f );
boost::thread t2( f );
system( "PAUSE" );
return 0;
}