MCPcopy Create free account
hub / github.com/Icinga/icinga2 / Enqueue

Method Enqueue

lib/base/workqueue.cpp:88–101  ·  view source on GitHub ↗

* Enqueues a task. Tasks are guaranteed to be executed in the order * they were enqueued in except if there is more than one worker thread or when * allowInterleaved is true in which case the new task might be run * immediately if it's being enqueued from within the WorkQueue thread. */

Source from the content-addressed store, hash-verified

86 * immediately if it's being enqueued from within the WorkQueue thread.
87 */
88void WorkQueue::Enqueue(std::function<void ()>&& function, WorkQueuePriority priority,
89 bool allowInterleaved)
90{
91 bool wq_thread = IsWorkerThread();
92
93 if (wq_thread && allowInterleaved) {
94 function();
95
96 return;
97 }
98
99 auto lock = AcquireLock();
100 EnqueueUnlocked(lock, std::move(function), priority);
101}
102
103/**
104 * Waits until all currently enqueued tasks have completed. This only works reliably

Callers 15

RelayMessageMethod · 0.45
ResumeMethod · 0.45
NewTransactionMethod · 0.45
ReconnectTimerHandlerMethod · 0.45
ReconnectMethod · 0.45
ActivateObjectMethod · 0.45
DeactivateObjectMethod · 0.45
ExecuteQueryMethod · 0.45
InternalExecuteQueryMethod · 0.45
FinishExecuteQueryMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected