![]() |
PIVX Core
5.6.99
P2P Digital Currency
|
Class used by CScheduler clients which may schedule multiple jobs which are required to be run serially. More...
#include <scheduler.h>
Public Member Functions | |
| SingleThreadedSchedulerClient (CScheduler *pschedulerIn) | |
| void | AddToProcessQueue (std::function< void(void)> func) |
| Add a callback to be executed. More... | |
| void | EmptyQueue () |
| size_t | CallbacksPending () |
Private Member Functions | |
| void | MaybeScheduleProcessQueue () |
| void | ProcessQueue () |
Private Attributes | |
| CScheduler * | m_pscheduler |
| RecursiveMutex | m_cs_callbacks_pending |
| std::list< std::function< void(void)> > | m_callbacks_pending |
| bool | m_are_callbacks_running = false |
Class used by CScheduler clients which may schedule multiple jobs which are required to be run serially.
Jobs may not be run on the same thread, but no two jobs will be executed at the same time and memory will be release-acquire consistent (the scheduler will internally do an acquire before invoking a callback as well as a release at the end). In practice this means that a callback B() will be able to observe all of the effects of callback A() which executed before it.
Definition at line 99 of file scheduler.h.
|
inlineexplicit |
Definition at line 111 of file scheduler.h.
| void SingleThreadedSchedulerClient::AddToProcessQueue | ( | std::function< void(void)> | func | ) |
Add a callback to be executed.
Callbacks are executed serially and memory is release-acquire consistent between callback executions. Practically, this means that callbacks can behave as if they are executed in order by a single thread.
Definition at line 168 of file scheduler.cpp.
| size_t SingleThreadedSchedulerClient::CallbacksPending | ( | ) |
Definition at line 188 of file scheduler.cpp.
| void SingleThreadedSchedulerClient::EmptyQueue | ( | ) |
|
private |
Definition at line 127 of file scheduler.cpp.
|
private |
Definition at line 139 of file scheduler.cpp.
|
private |
Definition at line 105 of file scheduler.h.
|
private |
Definition at line 104 of file scheduler.h.
|
private |
Definition at line 103 of file scheduler.h.
|
private |
Definition at line 101 of file scheduler.h.