A SERVICE OF

logo

150
Chapter 13: Multiprocessing
Cleaning the csContext Fields
Before rendering, the application thread must call csField::cleanFields() to clean the
csContext elds. This method forces the evaluation of all elds that have been dirty,
thereby circumventing the normal lazy evaluation of eld values. Generally, in Cosmo
3D, elds are updated only when queried.
To use this method, tracking of dirty elds must be enabled. This method enables safe
traversal of a scene by parallel rendering threads; lazy evaluation is not thread-safe.
To clean the elds, you must:
1. Enable cleaning by using the following method:
csField::enableDirtyFieldTracking();
2. Clean the elds by calling the following method each frame:
csField::cleanFields();
To see if dirty eld is enabled, use the following method:
csField::isDirtyFieldTrackingEnabled()
Multithreaded Example
For an example of a multi-threaded application, see twothread.cxx in
.../optimizer1.1/demos/optimizer/misc/.