static_assert( __cplusplus > 2020'99 ); #pragma once #include #include "Thread.h" namespace Alepha::Hydrogen ::detail:: ThreadGroup_m { inline namespace exports { class ThreadGroup; } class exports::ThreadGroup { private: std::vector< std::unique_ptr< Thread > > threads; public: template< typename Function > Thread * addThread( Function function ) { // TODO: Exception handler wrapper // TODO: lockstep start wrapper? threads.push_back( std::make_unique< Thread >( std::forward< Function >( function ) ) ); return threads.back().get(); } void join() { // TODO: Handle errors.... for( auto &thread: threads ) { thread->join(); } } }; } namespace Alepha::Hydrogen::inline exports::inline ThreadGroup_m { using namespace detail::ThreadGroup_m::exports; }