diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d24654..afd6717 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ add_subdirectory( Exception.test ) add_subdirectory( word_wrap.test ) add_subdirectory( string_algorithms.test ) add_subdirectory( tuplize_args.test ) +add_subdirectory( Thread.test ) # Sample applications add_executable( example example.cc ) diff --git a/Thread.h b/Thread.h index 2bfde46..240c4c9 100644 --- a/Thread.h +++ b/Thread.h @@ -4,9 +4,9 @@ static_assert( __cplusplus > 2020'99 ); #include -#include -#include -#include +#include +#include +#include #include @@ -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; } } diff --git a/Thread.test/CMakeLists.txt b/Thread.test/CMakeLists.txt new file mode 100644 index 0000000..b72b72c --- /dev/null +++ b/Thread.test/CMakeLists.txt @@ -0,0 +1,3 @@ +link_libraries( boost_thread ) + +unit_test( thread ) diff --git a/Thread.test/Makefile b/Thread.test/Makefile deleted file mode 100644 index f2f34d1..0000000 --- a/Thread.test/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -CXXFLAGS+= -std=c++2a -I ../ -CXXFLAGS+= -g -O0 -CXX=clang++-12 - -CXXFLAGS+= -Wno-inline-namespace-reopened-noninline -CXXFLAGS+= -Wno-unused-comparison - -LDLIBS+= -lboost_thread -lpthread - -all: thread diff --git a/Thread.test/thread.cc b/Thread.test/thread.cc index c692a8e..f7f7544 100644 --- a/Thread.test/thread.cc +++ b/Thread.test/thread.cc @@ -6,7 +6,7 @@ static_assert( __cplusplus > 2020'99 ); #include #include -#include +#include namespace { @@ -36,7 +36,7 @@ namespace } catch( const boost::thread_interrupted & ) { - std::cerr << "SHIT! We didn't get intercepted!" << std::endl; + std::cerr << "OOPS! We didn't get intercepted!" << std::endl; throw; } catch( const MyNotification &n )