fiber
Loading...
Searching...
No Matches
fiber::CoSignal Class Reference

A signal that can be sent from an awaitable to the Task and Scheduler. More...

#include <CoSignal.hpp>

Public Types

enum class  Type {
  None = 0 , Await , NextCycle , ImplicitDelay ,
  ExplicitDelay
}
 Type of the contained signal. More...
 

Public Member Functions

constexpr CoSignalnone ()
 Send no signal to the Task/Scheduler or clear the previous one.
 
constexpr CoSignalawait ()
 Send an await signal to the Task/Scheduler. The Coroutine is waiting on an external event (Hardware/IO/other task/etc.)
 
constexpr CoSignalnext_cycle ()
 Send the completion of this cycle and trigger the recalculation of the next one.
 
constexpr CoSignalimplicit_delay (fiber::Duration delay)
 Suspend execution and delay the next schedule.
 
constexpr CoSignalexplicit_delay (fiber::Duration delay, fiber::Duration rel_deadline)
 Suspend execution and delay the next schedule.
 
constexpr Type type () const
 Get the signal type.
 
constexpr fiber::Duration delay () const
 get the implicit delay time
 
constexpr fiber::Duration deadline () const
 get the explicit delay time
 

Detailed Description

A signal that can be sent from an awaitable to the Task and Scheduler.

Enables stuff like:

co_await Delay(5ms)
Definition Delay.hpp:15

and internally Delay sends an AwaitableNode::await_suspend_signal().

See also
AwaitableNode
Delay
NextCycle

Member Enumeration Documentation

◆ Type

enum class fiber::CoSignal::Type
strong

Type of the contained signal.

Enumerator
None 
Await 
NextCycle 
ImplicitDelay 
ExplicitDelay 

Member Function Documentation

◆ await()

CoSignal & fiber::CoSignal::await ( )
inlineconstexpr

Send an await signal to the Task/Scheduler. The Coroutine is waiting on an external event (Hardware/IO/other task/etc.)

◆ deadline()

fiber::Duration fiber::CoSignal::deadline ( ) const
inlineconstexpr

get the explicit delay time

Returns
the implicit delay time
Exceptions
IfASSERTION_LEVEL_O1 or higher is enabled: throws an AssertionFailure, if the signal does not hold an explicit delay

◆ delay()

fiber::Duration fiber::CoSignal::delay ( ) const
inlineconstexpr

get the implicit delay time

Returns
the implicit delay time
Exceptions
IfASSERTION_LEVEL_O1 or higher is enabled: throws an AssertionFailure, if the signal does not hold an implicit delay

◆ explicit_delay()

CoSignal & fiber::CoSignal::explicit_delay ( fiber::Duration delay,
fiber::Duration rel_deadline )
inlineconstexpr

Suspend execution and delay the next schedule.

Parameters
delaytime in ns relative to now
rel_deadlinetime in ns relative to the resulting ready time

◆ implicit_delay()

CoSignal & fiber::CoSignal::implicit_delay ( fiber::Duration delay)
inlineconstexpr

Suspend execution and delay the next schedule.

Parameters
delaytime in ns relative from now

◆ next_cycle()

CoSignal & fiber::CoSignal::next_cycle ( )
inlineconstexpr

Send the completion of this cycle and trigger the recalculation of the next one.

◆ none()

CoSignal & fiber::CoSignal::none ( )
inlineconstexpr

Send no signal to the Task/Scheduler or clear the previous one.

◆ type()

Type fiber::CoSignal::type ( ) const
inlineconstexpr

Get the signal type.

Returns
An enum Type

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