forked from Alepha/Alepha
Modernize thread code.
This commit is contained in:
@ -23,8 +23,8 @@ namespace
|
||||
"smoke"_test <=[] () -> bool
|
||||
{
|
||||
std::cerr << "Smoke started..." << std::endl;
|
||||
Alepha::Mutex access;
|
||||
Alepha::ConditionVariable cv;
|
||||
Alepha::mutex access;
|
||||
Alepha::condition_variable cv;
|
||||
auto threadMain= [&]
|
||||
{
|
||||
try
|
||||
@ -34,7 +34,7 @@ namespace
|
||||
cv.wait( lock );
|
||||
std::cerr << "Child thread awoken illegally!" << std::endl;
|
||||
}
|
||||
catch( const boost::thread_interrupted & )
|
||||
catch( const Alepha::ThreadInterrupted & )
|
||||
{
|
||||
std::cerr << "OOPS! We didn't get intercepted!" << std::endl;
|
||||
throw;
|
||||
@ -42,7 +42,6 @@ namespace
|
||||
catch( const MyNotification &n )
|
||||
{
|
||||
std::cerr << "I caught it: " << n.message() << "!" << std::endl;
|
||||
throw;
|
||||
}
|
||||
};
|
||||
|
||||
@ -52,7 +51,7 @@ namespace
|
||||
std::cerr << "Child thread now launched..." << std::endl;
|
||||
::sleep( 1 );
|
||||
access.unlock();
|
||||
thr.interrupt( Alepha::build_exception< MyNotification >( "My message" ) );
|
||||
thr.notify( Alepha::build_exception< MyNotification >( "My message" ) );
|
||||
thr.join();
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user