1
0
forked from Alepha/Alepha

Bring in the mockination work and Truss from old.

It's all a mess -- not in the new unified form and namespace.
I need to do a big cleanup pass.
This commit is contained in:
2023-02-09 21:30:38 -08:00
parent 306d2145a3
commit fd6060be17
21 changed files with 1898 additions and 0 deletions

72
Truss/thread.h Normal file
View File

@ -0,0 +1,72 @@
#pragma once
#include <Alepha/Alepha.h>
#include <Alepha/Truss/thread_common.h>
#include <thread>
#include <boost/thread.hpp>
#include <Alepha/Truss/function.h>
namespace Alepha::Hydrogen::Truss
{
ALEPHA_BOOST_THREAD namespace BoostThread
{
// If you decide to use Alepha threading primitives, you'll get the boost ones.
// Eventually we'd like to add interrupt-with-reason semantics. That will be in
// Alepha::Thread.
// I'd like to map Alepha::Truss's thread to be only std:: thread eventually.
// There will remain "boost::thread" semantics for Alepha, at present.
using boost::thread;
namespace this_thread= boost::this_thread;
namespace detail_thread
{
template< typename Ex >
auto
make_thrower( Ex &&exception )
{
return [exception]{ throw exception; };
}
}
}
ALEPHA_STD_THREAD namespace StdThread
{
// If you decide to use Alepha threading primitives, you'll get the boost ones.
// Eventually we'd like to add interrupt-with-reason semantics. That will be in
// Alepha::Thread.
// I'd like to map Alepha::Truss's thread to be only std:: thread eventually.
// There will remain "boost::thread" semantics for Alepha, at present.
using ::std::thread;
namespace this_thread= ::std::this_thread;
namespace detail_thread
{
template< typename Ex >
auto
make_thrower( Ex &&exception )
{
return [exception]{ throw exception; };
}
}
}
namespace under_construction
{
// Built on top of std::thread
class thread
{
private:
Alepha::Truss::function< void () > interruption;
::std::thread thread;
};
}
}