SPH
Public Member Functions | Static Public Member Functions | List of all members
SequentialScheduler Class Reference

Dummy scheduler that simply executes the submitted tasks sequentially on calling thread. More...

#include <Scheduler.h>

Inheritance diagram for SequentialScheduler:
IScheduler Polymorphic

Public Member Functions

virtual SharedPtr< ITasksubmit (const Function< void()> &task) override
 Submits a task to be potentially executed asynchronously. More...
 
virtual Optional< SizegetThreadIdx () 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...
 
- Public Member Functions inherited from IScheduler
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...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Static Public Member Functions

static SharedPtr< SequentialSchedulergetGlobalInstance ()
 

Detailed Description

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.

Member Function Documentation

◆ getGlobalInstance()

SharedPtr< SequentialScheduler > SequentialScheduler::getGlobalInstance ( )
static

Definition at line 38 of file Scheduler.cpp.

◆ getRecommendedGranularity()

Size SequentialScheduler::getRecommendedGranularity ( ) const
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.

◆ getThreadCnt()

Size SequentialScheduler::getThreadCnt ( ) const
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.

◆ getThreadIdx()

Optional< Size > SequentialScheduler::getThreadIdx ( ) const
overridevirtual

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.

◆ submit()

SharedPtr< ITask > SequentialScheduler::submit ( const Function< void()> &  task)
overridevirtual

Submits a task to be potentially executed asynchronously.

Returns
Handle to the task created from the functor.

Implements IScheduler.

Definition at line 19 of file Scheduler.cpp.


The documentation for this class was generated from the following files: