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

View File

@ -0,0 +1,51 @@
#include <Alepha/Atomic/Turnstile.h>
using Alepha::Atomic::Turnstile;
int
main()
{
}
namespace
{
namespace example1
{
//! [TurnstileExamples example1]
// Assume that the below code will run multithreaded
Turnstile myArena{ 8 };
void
mainLoop()
{
Turnstile::ScopedUsage active( myArena );
printf( "I am running in the arena, not everyone can." );
sleep( 100 );
}
//! [TurnstileExamples example1]
} // namespace example1
namespace example2
{
//! [TurnstileExamples example2]
Turnstile myArena{ 8 };
class Worker
{
public:
Worker()
{
myArena.enter();
}
// Assume some useful functionality
// The worker will destroy his access upon leaving
~Worker()
{
myArena.egress();
}
};
//! [TurnstileExamples example2]
} // namespace example2
} // namespace