Malloy
Loading...
Searching...
No Matches
Public Member Functions | List of all members
malloy::detail::action_queue< Executor > Class Template Reference

Stores and executes functions. More...

#include <action_queue.hpp>

Public Member Functions

 action_queue (ioc_t ioc)
 Construct the action queue. It will not execute anything until run() is called.
 
void push (act_t act)
 Add an action to the queue.
 
void run ()
 Starts the queue running, if it isn't already.
 

Detailed Description

template<typename Executor>
class malloy::detail::action_queue< Executor >

Stores and executes functions.

The next queued function is not executed until the callback passed to the last executed function is called

Note
All methods in this class are threadsafe
This class will be upgraded to coroutines once they become sufficently supported, see https://github.com/Tectu/malloy/issues/70 for more details
Warning
The callback passed must be called for the queue to continue running
Objects of this class do no explicit lifetime management for themselves. It is up to the owner of the object to ensure it is still alive when the callback is invoked
Template Parameters
ExecutorThe executor to use

Constructor & Destructor Documentation

◆ action_queue()

template<typename Executor >
malloy::detail::action_queue< Executor >::action_queue ( ioc_t  ioc)
inlineexplicit

Construct the action queue. It will not execute anything until run() is called.

Parameters
iocThe strand to use for synchronisation

Member Function Documentation

◆ push()

template<typename Executor >
void malloy::detail::action_queue< Executor >::push ( act_t  act)
inline

Add an action to the queue.

Note
If run() has been called and the queue is currently empty, the new action will run immediately.
Parameters
act
Here is the call graph for this function:

◆ run()

template<typename Executor >
void malloy::detail::action_queue< Executor >::run ( )
inline

Starts the queue running, if it isn't already.

Note
Only needs to be called once.

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