DiCE API nvidia_logo_transpbg.gif Up
mi::neuraylib::IScheduler Class Referenceabstract

The scheduler allows to execute fragmented jobs. More...

#include <dice.h>

Inheritance diagram for mi::neuraylib::IScheduler:

Public Member Functions

virtual Sint32 execute_fragmented (IFragmented_job *job, Size count)=0
 Executes a fragmented job synchronously (without transaction). More...
 
virtual Sint32 execute_fragmented_async (IFragmented_job *job, Size count, IExecution_listener *listener)=0
 Executes a fragmented job asynchronously (without transaction). More...
 
virtual void suspend_current_job ()=0
 Notifies the scheduler that this thread suspends jobs execution (because it is going to wait for some event). More...
 
virtual void resume_current_job ()=0
 Notifies the scheduler that this worker thread resumes job execution (because it waited for some event that now happened). More...
 
virtual void yield ()=0
 Notifies the thread pool that this worker thread is willing to give up its resources for a while in favor of other jobs of higher priority. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xd0754018, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xd0754018, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

The scheduler allows to execute fragmented jobs.

See mi::neuraylib::IScheduling_configuration for related configuration options.

Member Function Documentation

 execute_fragmented()

virtual Sint32 mi::neuraylib::IScheduler::execute_fragmented ( IFragmented_job job,
Size  count 
)
pure virtual

Executes a fragmented job synchronously (without transaction).

This method is similar to mi::neuraylib::IDice_transaction::execute_fragmented(). The difference is that here no transaction is involved, i.e., all methods of mi::neuraylib::IFragmented_job with a transaction argument will pass NULL for that argument.

Note
Currently, this method is restricted to local jobs (see mi::neuraylib::IFragmented_job::get_scheduling_mode()).

 execute_fragmented_async()

virtual Sint32 mi::neuraylib::IScheduler::execute_fragmented_async ( IFragmented_job job,
Size  count,
IExecution_listener listener 
)
pure virtual

Executes a fragmented job asynchronously (without transaction).

This method is similar to mi::neuraylib::IDice_transaction::execute_fragmented_async(). The difference is that here no transaction is involved, i.e., all methods of mi::neuraylib::IFragmented_job with a transaction argument will pass NULL for that argument.

Note
Currently, this method is restricted to local jobs (see mi::neuraylib::IFragmented_job::get_scheduling_mode()).

 resume_current_job()

virtual void mi::neuraylib::IScheduler::resume_current_job ( )
pure virtual

Notifies the scheduler that this worker thread resumes job execution (because it waited for some event that now happened).

The scheduler does not do anything except that it increases the current load values accordingly. This method blocks if the current load values and limits do not permit instant resuming of the job. The method returns immediately if not being called from a worker thread.

See also
suspend_current_job() for further details

 suspend_current_job()

virtual void mi::neuraylib::IScheduler::suspend_current_job ( )
pure virtual

Notifies the scheduler that this thread suspends jobs execution (because it is going to wait for some event).

The scheduler does not do anything except that it decreases the current load values accordingly. The method returns immediately if not being called from a worker thread.

Usage of this method is mandatory if a child job is executed asynchronously from within a parent job, and the parent job waits for the child job to complete. Usage of this method is strongly recommended (but not mandatory) if the parent jobs waits for some event unrelated to child jobs. Usage of this method is not necessary for synchronous execution of child jobs.

Failure to use this method when mandatory might lead to dead locks. Failure to use this method when recommended might lead to reduced performance.

Example:

...
scheduler->suspend_current_job();
condition.wait();
scheduler->resume_current_job();
Conditions allow threads to signal an event and to wait for such a signal, respectively.
Definition: condition.h:33
void wait()
Waits for the condition to be signaled.
Definition: condition.h:61

This method needs to be used in conjunction with resume_current_job().

 yield()

virtual void mi::neuraylib::IScheduler::yield ( )
pure virtual

Notifies the thread pool that this worker thread is willing to give up its resources for a while in favor of other jobs of higher priority.

Yielding is similar to calling suspend_current_job() followed by resume_current_job(), but it takes job priorities into account and is more efficient if there is no job of higher priority in the job queue.