MOTION  0.01
Framework for mixed-protocol multi-party computation
Public Member Functions | List of all members
encrypto::motion::FiberCondition Class Reference

Wraps a boost::fibers::condition_variable with a boost::fibers::mutex and a condition checking function. More...

#include <fiber_condition.h>

Public Member Functions

 ~FiberCondition ()=default
 
 FiberCondition ()=delete
 
 FiberCondition (FiberCondition &)=delete
 
 FiberCondition (const std::function< bool()> condition_function)
 Registers the condition function that encapsulates the condition checking. More...
 
void Wait () const
 Blocks until fiber is notified and condition_function_ returns true. More...
 
template<typename Tick , typename Period >
bool WaitFor (std::chrono::duration< Tick, Period > duration) const
 Blocks until fiber is notified and condition_function_ returns true or duration time has passed. More...
 
void NotifyOne () const noexcept
 Unblocks one thread waiting for condition_variable_. More...
 
void NotifyAll () const noexcept
 Unblocks all threads waiting for condition_variable_. More...
 
boost::fibers::mutex & GetMutex () noexcept
 Get the mutex. More...
 

Detailed Description

Wraps a boost::fibers::condition_variable with a boost::fibers::mutex and a condition checking function.

Constructor & Destructor Documentation

◆ ~FiberCondition()

encrypto::motion::FiberCondition::~FiberCondition ( )
default

◆ FiberCondition() [1/3]

encrypto::motion::FiberCondition::FiberCondition ( )
delete

◆ FiberCondition() [2/3]

encrypto::motion::FiberCondition::FiberCondition ( FiberCondition )
delete

◆ FiberCondition() [3/3]

encrypto::motion::FiberCondition::FiberCondition ( const std::function< bool()>  condition_function)
inline

Registers the condition function that encapsulates the condition checking.

Parameters
condition_function

Member Function Documentation

◆ GetMutex()

boost::fibers::mutex& encrypto::motion::FiberCondition::GetMutex ( )
inlinenoexcept

Get the mutex.

Note
The variables that the condition function depends on shall only be modified under the locked mutex.
Here is the caller graph for this function:

◆ NotifyAll()

void encrypto::motion::FiberCondition::NotifyAll ( ) const
inlinenoexcept

Unblocks all threads waiting for condition_variable_.

Here is the caller graph for this function:

◆ NotifyOne()

void encrypto::motion::FiberCondition::NotifyOne ( ) const
inlinenoexcept

Unblocks one thread waiting for condition_variable_.

◆ Wait()

void encrypto::motion::FiberCondition::Wait ( ) const
inline

Blocks until fiber is notified and condition_function_ returns true.

Here is the caller graph for this function:

◆ WaitFor()

template<typename Tick , typename Period >
bool encrypto::motion::FiberCondition::WaitFor ( std::chrono::duration< Tick, Period >  duration) const
inline

Blocks until fiber is notified and condition_function_ returns true or duration time has passed.


The documentation for this class was generated from the following file: