All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GusdErrorTransport Class Reference

Helper class used to propagate errors from different threads. More...

Inherits UT_NonCopyable.

Public Member Functions

 GusdErrorTransport (UT_ErrorManager *mgr=UTgetErrorManager())
 
 GusdErrorTransport (int thread)
 
void operator() ()
 
void StealErrors (UT_ErrorManager &victim, UT_ErrorSeverity sev=UT_ERROR_NONE, bool borrowOnly=false)
 
void StealGlobalErrors (UT_ErrorSeverity sev=UT_ERROR_NONE, bool borrowOnly=false)
 

Detailed Description

Helper class used to propagate errors from different threads.

There is a thread-local UT_ErrorManager for each thread in Houdini. Error reporting methods should generally just call UTaddError(), UTaddWarning(), etc. to report errors, – or GUSD_ERR, and similar helpers above – which will put errors on currently scoped UT_ErrorManager of the active thread. When splitting into threads, though, an additional step is required to pull any error messages from each thread that is spawned, to copy them back into the originating thread.

Example:

* GusdErrorTransport errTransport;
* UTparallelFor(
* UT_BlockedRange<size_t>(0,n),
* [&](const UT_BlockedRange<size_t>& r)
* {
* GusdAutoErrorTransport autoErrTransport(errTransport):
* UTaddError(...);
* ...
* });
*

Definition at line 111 of file error.h.


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