Files CCore/inc/task/SlowSem.h CCore/src/task/SlowSem.cpp
SlowSem is a semaphore. It is not necessary "slow". This variant is a lightweight wrapper over the OS semaphore. This semaphore is used as a building block in implementations of other synchronization objects.
class SlowSem : public Funchor_nocopy
{
Sys::Sem sem;
private:
void init(ulen count);
public:
// constructors
explicit SlowSem(ulen count=0);
explicit SlowSem(TextLabel name,ulen count=0);
~SlowSem();
// give
void give();
void give_many(ulen dcount);
// take
bool try_take();
void take();
bool take(MSec timeout);
bool take(TimeScope time_scope);
// functions
Function<void (void)> function_give() { return FunctionOf(this,&SlowSem::give); }
};
The implementation of the SlowSem is based on the target-provided Sys::Sem:
struct Sys::Sem
{
// private
....
// public
Sys::ErrorType init(ulen count=0);
void exit();
void give();
void give_many(ulen count);
bool try_take();
void take();
bool take(MSec timeout);
};