diff options
Diffstat (limited to 'include/weave/provider/task_runner.h')
-rw-r--r-- | include/weave/provider/task_runner.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/weave/provider/task_runner.h b/include/weave/provider/task_runner.h index 095910b..28ad42c 100644 --- a/include/weave/provider/task_runner.h +++ b/include/weave/provider/task_runner.h @@ -16,6 +16,27 @@ namespace weave { namespace provider { +// This interface should be implemented by the user of libweave and +// provided during device creation in Device::Create(...) +// libweave will use this interface to schedule task execution. +// +// libweave is a single threaded library that uses task scheduling (similar +// to message loop) to perform asynchronous tasks. libweave itself does not +// implement message loop, and rely on user to provide implementation +// for its platform. +// +// Implementation of PostDelayedTask(...) should add specified task (callback) +// after all current tasks in the queue with delay=0. If there are tasks in the +// queue with delay > 0, new task may be scheduled before or between existing +// tasks. Position of the new task in the queue depends on remaining delay for +// existing tasks and specified delay. Normally, new task should be scheduled +// after the last task with "remaining delay" <= "new task delay". This will +// guarantee that all tasks with delay=0 will be executed in the same order +// they are put in the task queue. +// +// If delay is specified, task should be invoked no sooner then timeout is +// reached (it might be delayed due to other tasks in the queue). + // Interface with methods to post tasks into platform-specific message loop of // the current thread. class TaskRunner { |