Skip to content

Commit b296b42

Browse files
committed
Update documentation for SingleThreadedSchedulerClient() to specify the memory model
1 parent 9994d01 commit b296b42

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/scheduler.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,13 @@ class CScheduler
8686

8787
/**
8888
* Class used by CScheduler clients which may schedule multiple jobs
89-
* which are required to be run serially. Does not require such jobs
90-
* to be executed on the same thread, but no two jobs will be executed
91-
* at the same time.
89+
* which are required to be run serially. Jobs may not be run on the
90+
* same thread, but no two jobs will be executed
91+
* at the same time and memory will be release-acquire consistent
92+
* (the scheduler will internally do an acquire before invoking a callback
93+
* as well as a release at the end). In practice this means that a callback
94+
* B() will be able to observe all of the effects of callback A() which executed
95+
* before it.
9296
*/
9397
class SingleThreadedSchedulerClient {
9498
private:
@@ -103,6 +107,13 @@ class SingleThreadedSchedulerClient {
103107

104108
public:
105109
explicit SingleThreadedSchedulerClient(CScheduler *pschedulerIn) : m_pscheduler(pschedulerIn) {}
110+
111+
/**
112+
* Add a callback to be executed. Callbacks are executed serially
113+
* and memory is sequentially consistent between callback executions.
114+
* Practially, this means that callbacks can behave as if they are executed
115+
* in order by a single thread.
116+
*/
106117
void AddToProcessQueue(std::function<void (void)> func);
107118

108119
// Processes all remaining queue members on the calling thread, blocking until queue is empty

0 commit comments

Comments
 (0)