About
A condition variable is used to wake a waiting thread to perform some action. It is typically used together with custom threads, see Threads Manual.
Condition
A condition variable is based on maxon::ConditionVariableInterface:
- Warning
 - Waiting for a condition variable in a job might result in a deadlock. Consider using LazyInit or LazyInitThreaded for initialization instead.
 
A condition variable can have multiple dependencies. This means that Set() must be called multiple times:
A condition variable is typically used as a member variable of a custom thread:
 
{
public:
  ~ExampleThread() { }
 
  {
    
  }
 
  
  maxon::Result<
void> operator ()()
 
  {
    {
      
      if (_condition.Wait(timeValue))
      {
 
        
        _condition.Clear();
      }
    }
 
  }
 
  
  void Action()
  {
    _condition.Set();
  }
 
 
private:
  maxon::ConditionVariableRef _condition; 
};
Timer value in seconds.
Definition: timevalue.h:411
 
@ OK
User has selected a font.
 
char Char
signed 8 bit character
Definition: apibase.h:198
 
static auto Create(ARGS &&... args)
Definition: apibase.h:2818
 
return OK
Definition: apibase.h:2735
 
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:170
 
const Char * GetName() const
Definition: job.h:189
 
Bool IsCancelled() const
Checks if the job should stop. THREADSAFE.
Definition: job.h:307
 
The maxon namespace contains all declarations of the MAXON API.
Definition: autoweight.h:14
 
#define iferr_scope
Definition: resultbase.h:1389
 
#define iferr_return
Definition: resultbase.h:1524
 
  This example thread can be used like this:
  
 
  if (!g_exampleThread)
  {
    
 
  }
 
  if (g_exampleThread)
  {
    
    g_exampleThread->Action();
  }
#define NewObj(T,...)
Definition: newobj.h:108
 
  
Further Reading