neuray API Programmer's Manual

mi::neuraylib::IMdl_loading_wait_handle Class Reference

[Miscellaneous MDL-related Interfaces]

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.

Public Member Functions

virtual Sint32 get_result_code() const =0
Gets the result code that was passed to notify. More...
virtual void notify( Sint32 result_code) =0
Called by the loading thread after loading is done to wake the waiting threads. More...
virtual void wait() =0
Called when the element is currently loaded by another threads. More...

Member Functions

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.

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_code
The 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.
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.