|
| Sequencer (Dispatcher &dispatcher, const Configuration &configuration=Configuration()) |
| Constructor. More...
|
|
template<class FUNC , class ... ARGS> |
void | post (const SequenceKey &sequenceKey, FUNC &&func, ARGS &&... args) |
| Post a coroutine to run asynchronously. More...
|
|
template<class FUNC , class ... ARGS> |
void | post (void *opaque, int queueId, bool isHighPriority, const SequenceKey &sequenceKey, FUNC &&func, ARGS &&... args) |
| Post a coroutine to run asynchronously on a specific queue (thread). More...
|
|
template<class FUNC , class ... ARGS> |
void | post (const std::vector< SequenceKey > &sequenceKeys, FUNC &&func, ARGS &&... args) |
| Post a coroutine to run asynchronously. More...
|
|
template<class FUNC , class ... ARGS> |
void | post (void *opaque, int queueId, bool isHighPriority, const std::vector< SequenceKey > &sequenceKeys, FUNC &&func, ARGS &&... args) |
| Post a coroutine to run asynchronously on a specific queue (thread). More...
|
|
template<class FUNC , class ... ARGS> |
void | postAll (FUNC &&func, ARGS &&... args) |
| Post a coroutine to run asynchronously. More...
|
|
template<class FUNC , class ... ARGS> |
void | postAll (void *opaque, int queueId, bool isHighPriority, FUNC &&func, ARGS &&... args) |
| Post a coroutine to run asynchronously on a specific queue (thread). More...
|
|
size_t | trimSequenceKeys () |
| Trims the sequence keys not used by the sequencer anymore. More...
|
|
size_t | getSequenceKeyCount () |
| Gets the number of tracked sequence keys. More...
|
|
SequenceKeyStatistics | getStatistics (const SequenceKey &sequenceKey) |
| Gets the sequencer statistics for a specific sequence key. More...
|
|
SequenceKeyStatistics | getStatistics () |
| Gets the sequencer statistics for the 'universal key', a.k.a. posted via postAll() method. More...
|
|
SequenceKeyStatistics | getTaskStatistics () |
| Gets the sequencer statistics for all jobs. More...
|
|
template<class SequenceKey, class Hash = std::hash<SequenceKey>, class KeyEqual = std::equal_to<SequenceKey>, class Allocator = std::allocator<std::pair<const SequenceKey, SequenceKeyData>>>
class Bloomberg::quantum::Sequencer< SequenceKey, Hash, KeyEqual, Allocator >
Implementation of a key-based task sequencing with quantum.
- Template Parameters
-
SequenceKey | Type of the key based that sequenced tasks are associated with |
Hash | Hash-function used for storing instances of SequenceKey in hash maps |
KeyEqual | The equal-function used for storing instances of SequenceKey in hash maps |
Allocator | The allocator used for storing instances of SequenceKey in hash maps |
template<class SequenceKey , class Hash , class KeyEqual , class Allocator >
template<class FUNC , class ... ARGS>
Post a coroutine to run asynchronously.
This method will post the coroutine on any thread available and will run when the previous coroutine associated with the same 'sequenceKey' completes. If there are none, it will run immediately. (
- See also
- Dispatcher::post for more details).
- Template Parameters
-
FUNC | Callable object type which will be wrapped in a coroutine |
ARGS | Argument types passed to FUNC ( |
- See also
- Dispatcher::post for more details).
- Parameters
-
[in] | sequenceKey | SequenceKey object that the posted task is associated with |
[in] | func | Callable object. |
[in] | args | Variable list of arguments passed to the callable object. |
- Note
- This function is non-blocking and returns immediately.
- See also
- Configuration::setCoroQueueIdRangeForAny) does not contain the control queue id (
-
SequencerConfiguration::setControlQueueId).
template<class SequenceKey , class Hash , class KeyEqual , class Allocator >
template<class FUNC , class ... ARGS>
void Bloomberg::quantum::Sequencer< SequenceKey, Hash, KeyEqual, Allocator >::post |
( |
void * |
opaque, |
|
|
int |
queueId, |
|
|
bool |
isHighPriority, |
|
|
const SequenceKey & |
sequenceKey, |
|
|
FUNC && |
func, |
|
|
ARGS &&... |
args |
|
) |
| |
Post a coroutine to run asynchronously on a specific queue (thread).
This method will post the coroutine on any thread available and will run when the previous coroutine associated with the same 'sequenceKey' completes. If there are none, it will run immediately. (
- See also
- Dispatcher::post for more details).
- Template Parameters
-
FUNC | Callable object type which will be wrapped in a coroutine |
ARGS | Argument types passed to FUNC ( |
- See also
- Dispatcher::post for more details).
- Parameters
-
[in] | queueId | Id of the queue where this coroutine should run. Note that the user can specify IQueue::QueueId::Any as a value, which is equivalent to running the simpler version of post() above. Valid range is [0, numCoroutineThreads) or IQueue::QueueId::Any. |
[in] | isHighPriority | If set to true, the sequencer coroutine will be scheduled right after the currently executing coroutine on 'queueId'. |
[in] | opaque | pointer to opaque data that is passed to the exception handler (if provided) if an unhandled exception is thrown in func |
[in] | sequenceKey | SequenceKey object that the posted task is associated with |
[in] | func | Callable object. |
[in] | args | Variable list of arguments passed to the callable object. |
- Note
- This function is non-blocking and returns immediately.
- See also
- SequencerConfiguration::setControlQueueId). Hence, if IQueue::QueueId::Any is intended to be used as queueId here, then it is suggested that the configured Any-coroutine-queue-range (
-
Configuration::setCoroQueueIdRangeForAny) does not contain the control queue id.
template<class SequenceKey , class Hash , class KeyEqual , class Allocator >
template<class FUNC , class ... ARGS>
Post a coroutine to run asynchronously.
This method will post the coroutine on any thread available and will run when the previous coroutine(s) associated with all the 'sequenceKeys' complete. If there are none, then it will run immediately. (
- See also
- Dispatcher::post for more details).
- Template Parameters
-
FUNC | Callable object type which will be wrapped in a coroutine |
ARGS | Argument types passed to FUNC ( |
- See also
- Dispatcher::post for more details).
- Parameters
-
[in] | sequenceKeys | A collection of sequenceKey objects that the posted task is associated with |
[in] | func | Callable object. |
[in] | args | Variable list of arguments passed to the callable object. |
- Note
- This function is non-blocking and returns immediately.
- See also
- Configuration::setCoroQueueIdRangeForAny) does not contain the control queue id (
-
SequencerConfiguration::setControlQueueId).
template<class SequenceKey , class Hash , class KeyEqual , class Allocator >
template<class FUNC , class ... ARGS>
void Bloomberg::quantum::Sequencer< SequenceKey, Hash, KeyEqual, Allocator >::post |
( |
void * |
opaque, |
|
|
int |
queueId, |
|
|
bool |
isHighPriority, |
|
|
const std::vector< SequenceKey > & |
sequenceKeys, |
|
|
FUNC && |
func, |
|
|
ARGS &&... |
args |
|
) |
| |
Post a coroutine to run asynchronously on a specific queue (thread).
This method will post the coroutine on any thread available and will run when the previous coroutine(s) associated with all the 'sequenceKeys' complete. If there are none, then it will run immediately. (
- See also
- Dispatcher::post for more details).
- Template Parameters
-
FUNC | Callable object type which will be wrapped in a coroutine. |
ARGS | Argument types passed to FUNC ( |
- See also
- Dispatcher::post for more details).
- Parameters
-
[in] | queueId | Id of the queue where this coroutine should run. Note that the user can specify IQueue::QueueId::Any as a value, which is equivalent to running the simpler version of post() above. Valid range is [0, numCoroutineThreads) or IQueue::QueueId::Any. |
[in] | isHighPriority | If set to true, the sequencer coroutine will be scheduled right after the currently executing coroutine on 'queueId'. |
[in] | opaque | pointer to opaque data that is passed to the exception handler (if provided) if an unhandled exception is thrown in func |
[in] | sequenceKeys | A collection of sequenceKey objects that the posted task is associated with |
[in] | func | Callable object. |
[in] | args | Variable list of arguments passed to the callable object. |
- Note
- This function is non-blocking and returns immediately.
- See also
- SequencerConfiguration::setControlQueueId). Hence, if IQueue::QueueId::Any is intended to be used as queueId here, then it is suggested that the configured Any-coroutine-queue-range (
-
Configuration::setCoroQueueIdRangeForAny) does not contain the control queue id.
template<class SequenceKey , class Hash , class KeyEqual , class Allocator >
template<class FUNC , class ... ARGS>
Post a coroutine to run asynchronously.
This method will post the coroutine on any thread available. The posted task is assumed to be associated with the entire universe of sequenceKeys already running or pending, which means that it will wait until all tasks complete. This task can be considered as having a 'universal' key.
- Template Parameters
-
FUNC | Callable object type which will be wrapped in a coroutine |
ARGS | Argument types passed to FUNC ( |
- See also
- Dispatcher::post for more details).
- Parameters
-
[in] | func | Callable object. |
[in] | args | Variable list of arguments passed to the callable object. |
- Note
- This function is non-blocking and returns immediately.
- See also
- Configuration::setCoroQueueIdRangeForAny) does not contain the control queue id (
-
SequencerConfiguration::setControlQueueId).
template<class SequenceKey , class Hash , class KeyEqual , class Allocator >
template<class FUNC , class ... ARGS>
Post a coroutine to run asynchronously on a specific queue (thread).
This method will post the coroutine on any thread available. The posted task is assumed to be associated with the entire universe of sequenceKeys already running or pending, which means that it will wait until all tasks complete. This task can be considered as having a 'universal' key.
- Template Parameters
-
FUNC | Callable object type which will be wrapped in a coroutine. |
ARGS | Argument types passed to FUNC ( |
- See also
- Dispatcher::post for more details).
- Parameters
-
[in] | queueId | Id of the queue where this coroutine should run. Note that the user can specify IQueue::QueueId::Any as a value, which is equivalent to running the simpler version of post() above. Valid range is [0, numCoroutineThreads) or IQueue::QueueId::Any. |
[in] | isHighPriority | If set to true, the sequencer coroutine will be scheduled right after the currently executing coroutine on 'queueId'. |
[in] | opaque | pointer to opaque data that is passed to the exception handler (if provided) if an unhandled exception is thrown in func |
[in] | func | Callable object. |
[in] | args | Variable list of arguments passed to the callable object. |
- Note
- This function is non-blocking and returns immediately.
- See also
- SequencerConfiguration::setControlQueueId). Hence, if IQueue::QueueId::Any is intended to be used as queueId here, then it is suggested that the configured Any-coroutine-queue-range (
-
Configuration::setCoroQueueIdRangeForAny) does not contain the control queue id.