RenderMan API  23.0
RixThreadUtils Class Referenceabstract

#include <RixInterfaces.h>

Inheritance diagram for RixThreadUtils:
RixInterface

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
 
virtual void ParallelFor (size_t start, size_t end, size_t step, const RixFunction< void(size_t)> &fn) const =0
 
- Public Member Functions inherited from RixInterface
virtual int GetVersion () const
 

Protected Member Functions

 RixThreadUtils ()
 Constructor is for internal use only. More...
 
- Protected Member Functions inherited from RixInterface
 RixInterface (int version)
 Interfaces should not be constructed by users. More...
 
virtual ~RixInterface ()
 Interfaces should not be deleted by users. More...
 

Additional Inherited Members

- Public Types inherited from RixInterface
enum  Type {
  k_Float, k_Integer, k_StringV, k_Color,
  k_Normal, k_Vector, k_Point, k_HPoint,
  k_MPoint, k_Matrix
}
 
- Protected Attributes inherited from RixInterface
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

Definition at line 1465 of file RixInterfaces.h.

Constructor & Destructor Documentation

◆ RixThreadUtils()

RixThreadUtils::RixThreadUtils ( )
inlineprotected

Constructor is for internal use only.

Definition at line 1504 of file RixInterfaces.h.

Member Function Documentation

◆ DeleteMutex()

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

Used to delete a RixMutex object.

◆ 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

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