1
0
forked from Alepha/Alepha

Modernize thread code.

This commit is contained in:
2023-11-14 15:04:04 -05:00
parent c6b66aa7b5
commit b8d6c5aced
4 changed files with 208 additions and 149 deletions

View File

@ -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;