MDL SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::IMdl_loading_wait_handle Class Referenceabstract

Interface of a loading wait handle. More...

#include <imdl_loading_wait_handle.h>

Inheritance diagram for mi::neuraylib::IMdl_loading_wait_handle:

Public Member Functions

virtual void wait ()=0
 Called when the element is currently loaded by another threads. More...
 
virtual void notify (Sint32 result_code)=0
 Called by the loading thread after loading is done to wake the waiting threads. More...
 
virtual Sint32 get_result_code () const =0
 Gets the result code that was passed to notify. 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< 0xc942596c, ... >
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< 0xc942596c, ... >
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

Interface of a loading wait handle.

When loading in parallel, the element is loaded only in the context of the first call to load function. Every further thread that is trying to load this element either directly or indirectly using imports will block until the initial loading process has ended. This interface allows to specify how the waiting and the awakening of threads is realized. The default implementation that comes with the SDK uses conditional variable of the standard template library. It is sufficient for most applications. Only in case the application wants to use a custom thread scheduling or light weight threads that are not compatible with std, this interface, along with the corresponding factory, has to be implemented.

Member Function Documentation

 get_result_code()

virtual Sint32 mi::neuraylib::IMdl_loading_wait_handle::get_result_code ( ) const
pure virtual

Gets the result code that was passed to notify.

This allows waiting threads to query the result of the loading process after returning from wait.

Returns
The result code.

 notify()

virtual void mi::neuraylib::IMdl_loading_wait_handle::notify ( Sint32  result_code)
pure virtual

Called by the loading thread after loading is done to wake the waiting threads.

Other threads are not supposed to call this method. It is allowed to call notify multiple times
if other threads are waiting or not. However, it is not allowed to call notify multiple times with different result_codes.

Parameters
result_codeThe result code that is passed to the waiting threads. Values >= are indicate that the loaded element is available. Negative values are treated as failure for dependent element.

 wait()

virtual void mi::neuraylib::IMdl_loading_wait_handle::wait ( )
pure virtual

Called when the element is currently loaded by another threads.

Blocks until the loading thread calls notify. Calling wait after notify has been called already is valid. wait will not block in this case and return silently. The number of threads that can wait at the same time is not limited. The order in which threads awake after notify has been called is not specified.