RenderManAPI  24.0
RixThreadUtils Class Referenceabstract

NOTE: This interface is deprecated and will be removed in a future release This object is used to create a RixMutex object that can be used for locking access to shared global memory. More...

#include <RixInterfaces.h>

Inherits RixInterface.

Public Types

enum  Type {
  k_Float, k_Integer, k_StringV, k_Color,
  k_Normal, k_Vector, k_Point, k_HPoint,
  k_MPoint, k_Matrix
}
 

Public Member Functions

virtual RixMutexNewMutex () const =0
 Get a new RixMutex object. NOTE: It must be deleted with DeleteMutex. More...
 
virtual void DeleteMutex (RixMutex *mutex) const =0
 Used to delete a RixMutex object. More...
 
virtual void ParallelFor (size_t start, size_t end, const RixFunction< void(size_t)> &fn) const =0
 Performs parallel iteration over a range of values using the RenderMan thread scheduler. More...
 
virtual void ParallelFor (size_t start, size_t end, size_t step, const RixFunction< void(size_t)> &fn) const =0
 
virtual int GetVersion () const
 Get the version number of this interface. More...
 

Protected Member Functions

 RixThreadUtils ()
 Constructor is for internal use only. More...
 

Protected Attributes

int m_version
 Version number of this interface. More...
 

Detailed Description

NOTE: This interface is deprecated and will be removed in a future release This object is used to create a RixMutex object that can be used for locking access to shared global memory.

Member Enumeration Documentation

◆ Type

enum RixInterface::Type
inherited
Enumerator
k_Float 
k_Integer 
k_StringV 
k_Color 
k_Normal 
k_Vector 
k_Point 
k_HPoint 
k_MPoint 
k_Matrix 

Constructor & Destructor Documentation

◆ RixThreadUtils()

RixThreadUtils::RixThreadUtils ( )
inlineprotected

Constructor is for internal use only.

Member Function Documentation

◆ DeleteMutex()

virtual void RixThreadUtils::DeleteMutex ( RixMutex mutex) const
pure virtual

Used to delete a RixMutex object.

◆ GetVersion()

virtual int RixInterface::GetVersion ( ) const
inlinevirtualinherited

Get the version number of this interface.

Different interfaces might have different version numbers in a given release.

References RixInterface::m_version.

◆ NewMutex()

virtual RixMutex* RixThreadUtils::NewMutex ( ) const
pure virtual

Get a new RixMutex object. NOTE: It must be deleted with DeleteMutex.

◆ ParallelFor() [1/2]

virtual void RixThreadUtils::ParallelFor ( size_t  start,
size_t  end,
const RixFunction< void(size_t)> &  fn 
) const
pure virtual

Performs parallel iteration over a range of values using the RenderMan thread scheduler.

Calls to ParallelFor can be nested to parallelize complex loops and perform automatic load balancing. The typical use of ParallelFor is in combination with C++11 lambdas:

RixThreadUtils* rtu = (RixThreadUtils*)ctx->GetRixInterface(k_RixThreadUtils);

// Simple parallel loop rtu->ParallelFor(0, 1000, [&](size_t i) { some_computation(i); });

// Nested parallel loop rtu->ParallelFor(0, 1000, [&](size_t i) { // Pay attention on how the nested lambda captures "i" by value. rtu->ParallelFor(0, 1000, [&, i](size_t j) { some_computation(i, j); } });

◆ ParallelFor() [2/2]

virtual void RixThreadUtils::ParallelFor ( size_t  start,
size_t  end,
size_t  step,
const RixFunction< void(size_t)> &  fn 
) const
pure virtual

Member Data Documentation

◆ m_version

int RixInterface::m_version
protectedinherited

Version number of this interface.

Referenced by RixInterface::GetVersion().


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