diff options
author | Jesse Cohen <jc@jc.lol> | 2018-05-16 11:10:31 -0400 |
---|---|---|
committer | Jesse Cohen <jc@jc.lol> | 2018-07-30 19:41:59 -0400 |
commit | b296b425a7d35a285764d8b5be09a069a9a5a020 (patch) | |
tree | 440d0b8cb46fb33febf4ba942a2eb044daebfc16 /src/scheduler.h | |
parent | 9994d01d8b5aacc315bf985149441692b3abaf1a (diff) |
Update documentation for SingleThreadedSchedulerClient() to specify the memory model
Diffstat (limited to 'src/scheduler.h')
-rw-r--r-- | src/scheduler.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/scheduler.h b/src/scheduler.h index a41838a295..f96efe9f6b 100644 --- a/src/scheduler.h +++ b/src/scheduler.h @@ -86,9 +86,13 @@ private: /** * Class used by CScheduler clients which may schedule multiple jobs - * which are required to be run serially. Does not require such jobs - * to be executed on the same thread, but no two jobs will be executed - * at the same time. + * 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. */ class SingleThreadedSchedulerClient { private: @@ -103,6 +107,13 @@ private: public: explicit SingleThreadedSchedulerClient(CScheduler *pschedulerIn) : m_pscheduler(pschedulerIn) {} + + /** + * Add a callback to be executed. Callbacks are executed serially + * and memory is sequentially consistent between callback executions. + * Practially, this means that callbacks can behave as if they are executed + * in order by a single thread. + */ void AddToProcessQueue(std::function<void (void)> func); // Processes all remaining queue members on the calling thread, blocking until queue is empty |