Mercury Currency Engine
Classes | Public Member Functions | List of all members
mce::scheduler::parkable Struct Reference

object containing information to block and unblock a coroutine (running in a scheduler) or thread More...

#include <scheduler.hpp>

Classes

class  unpark_exception
 

Public Member Functions

template<typename LOCK >
void park (LOCK &lk)
 blocking call until unpark, unlocks and relocks given lock as necessary
 
template<typename LOCK >
void unpark (LOCK &lk)
 unblock parked operation and reschedule it for execution. More...
 

Detailed Description

object containing information to block and unblock a coroutine (running in a scheduler) or thread

This object abstracts the details of coroutine and thread blocking into a unified high level park()/unpark() API.

Parking is the operation that allows a given coroutine to suspend its own execution in a scheduler until said coroutine is unparked, upon which it will be rescheduled for execution. This functionality is typically used only by basic coroutine blocking mechanisms (see chan, buffered_channel, unbuffered_channel, united_mutex, united_condition_variable, etc.).

A blocking operation is done by the calling code creating a parkable object and using said object to manipulate its execution state by calling parkable::park() to suspend execution until another coroutine or thread calls the parkable::unpark() function.

Typical usage is:

Member Function Documentation

◆ unpark()

template<typename LOCK >
void mce::scheduler::parkable::unpark ( LOCK &  lk)
inline

unblock parked operation and reschedule it for execution.

Returns
true if the unpark operation succeeded, else false

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