1
0
forked from Alepha/Alepha

Rehabilitate the Thread type and test.

This commit is contained in:
2023-11-08 04:33:09 -05:00
parent eb2ac15e65
commit 8f96c9e888
5 changed files with 20 additions and 26 deletions

View File

@ -4,9 +4,9 @@ static_assert( __cplusplus > 2020'99 );
#include <Alepha/Alepha.h>
#include <Alepha/boost_path/thread.hpp>
#include <Alepha/boost_path/thread/mutex.hpp>
#include <Alepha/boost_path/thread/condition_variable.hpp>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <Alepha/Exception.h>
@ -42,7 +42,7 @@ namespace Alepha::Hydrogen
{
callable();
}
catch( const boost_ns::thread_interrupted & )
catch( const boost::thread_interrupted & )
{
std::lock_guard lock( access );
if( not notification ) throw;
@ -63,7 +63,7 @@ namespace Alepha::Hydrogen
namespace exports
{
class ConditionVariable
: private boost_ns::condition_variable
: private boost::condition_variable
{
public:
using condition_variable::notify_all;
@ -89,17 +89,17 @@ namespace Alepha::Hydrogen
{
template< typename Clock, typename Duration >
void
sleep_until( const boost_ns::chrono::time_point< Clock, Duration > &abs_time )
sleep_until( const boost::chrono::time_point< Clock, Duration > &abs_time )
{
notification.check_interrupt( [&]{ boost_ns::this_thread::sleep_until( abs_time ); } );
notification.check_interrupt( [&]{ boost::this_thread::sleep_until( abs_time ); } );
}
#if 0
template< typename Rep, typename Period >
void
sleep_for( const boost_ns::chrono::duration< Rep, Period > &rel_time )
sleep_for( const boost::chrono::duration< Rep, Period > &rel_time )
{
notification.check_interrupt( [&]( boost_ns::this_thread::sleep_until( rel_time ); } );
notification.check_interrupt( [&]( boost::this_thread::sleep_until( rel_time ); } );
}
#endif
}
@ -113,7 +113,7 @@ namespace Alepha::Hydrogen
namespace exports
{
class Thread
: ThreadNotification, boost_ns::thread
: ThreadNotification, boost::thread
{
public:
template< typename Callable >
@ -153,10 +153,10 @@ namespace Alepha::Hydrogen
}
};
using Mutex= boost_ns::mutex;
using boost_ns::mutex;
using boost_ns::unique_lock;
using boost_ns::lock_guard;
using Mutex= boost::mutex;
using boost::mutex;
using boost::unique_lock;
using boost::lock_guard;
}
}