SPH
|
Dummy scheduler that simply executes the submitted tasks sequentially on calling thread. More...
#include <Scheduler.h>
Public Member Functions | |
virtual SharedPtr< ITask > | submit (const Function< void()> &task) override |
Submits a task to be potentially executed asynchronously. More... | |
virtual Optional< Size > | getThreadIdx () const override |
Returns the index of the calling thread. More... | |
virtual Size | getThreadCnt () const override |
Returns the number of threads used by this scheduler. More... | |
virtual Size | getRecommendedGranularity () const override |
Returns a value of granularity that is expected to perform well with the current thread count. More... | |
![]() | |
virtual void | parallelFor (const Size from, const Size to, const Size granularity, const Function< void(Size n1, Size n2)> &functor) |
Processes the given range concurrently. More... | |
![]() | |
virtual | ~Polymorphic () |
Static Public Member Functions | |
static SharedPtr< SequentialScheduler > | getGlobalInstance () |
Dummy scheduler that simply executes the submitted tasks sequentially on calling thread.
Useful to run an algorithm with no parallelization, mainly for testing/debugging purposes.
Definition at line 67 of file Scheduler.h.
|
static |
Definition at line 38 of file Scheduler.cpp.
|
overridevirtual |
Returns a value of granularity that is expected to perform well with the current thread count.
Implements IScheduler.
Definition at line 34 of file Scheduler.cpp.
|
overridevirtual |
Returns the number of threads used by this scheduler.
Note that this number is constant during the lifetime of the scheduler.
Implements IScheduler.
Definition at line 29 of file Scheduler.cpp.
Returns the index of the calling thread.
If this thread was not invoked by the scheduler, returns NOTHING. The returned index is interval [0, getThreadCnt()-1].
Implements IScheduler.
Definition at line 24 of file Scheduler.cpp.
Submits a task to be potentially executed asynchronously.
Implements IScheduler.
Definition at line 19 of file Scheduler.cpp.