libcmutils 0.6.5
Multi-platform C99 utility library
Loading...
Searching...
No Matches

Platform independent condition definition for concurrency control. More...

Data Fields

void(* Wait )(CMUTIL_Cond *cond)
 Wait for this condition is set.
 
CMBool(* TimedWait )(CMUTIL_Cond *cond, long millisec)
 Waits with timeout.
 
void(* Set )(CMUTIL_Cond *cond)
 Sets this condition object.
 
void(* Reset )(CMUTIL_Cond *cond)
 Unsets this condition object.
 
void(* Destroy )(CMUTIL_Cond *cond)
 Destroys all resources related to this object.
 

Detailed Description

Platform independent condition definition for concurrency control.

Condition (or Event)

Field Documentation

◆ Wait

void(* CMUTIL_Cond::Wait) (CMUTIL_Cond *cond)

Wait for this condition is set.

This operation is blocked until this condition is set.

Parameters
condthis condition object.

◆ TimedWait

CMBool(* CMUTIL_Cond::TimedWait) (CMUTIL_Cond *cond, long millisec)

Waits with timeout.

Waits until this condition is set or the time-out interval elapses.

Parameters
condthis condition object.
millisecThe time-out interval, in milliseconds. If a nonzero value is specified, this method waits until the condition is set or the interval elapses. If millisec is zero, the function does not enter a wait state if this condition is not set, it always returns immediately.
Returns
CMTrue if this condition is set in given interval, CMFalse otherwise.

◆ Set

void(* CMUTIL_Cond::Set) (CMUTIL_Cond *cond)

Sets this condition object.

The state of a manual-reset condition object remains set until it is explicitly to the nonsignaled state by the Reset method. Any number of waiting threads, or threads that subsequently begin wait operations for this condition object by calling one of the wait functions, can be released while this condition state is signaled.

The state of an auto-reset condition object remains signaled until a single waiting thread is released, at which time the system automatically resets this condition state to nonsignaled. If no threads are waiting, this condition object's state remains signaled.

If this condition object is set already, calling this method will have no effect.

Parameters
condthis condition object.

◆ Reset

void(* CMUTIL_Cond::Reset) (CMUTIL_Cond *cond)

Unsets this condition object.

The state of this condition object remains nonsignaled until it is explicitly set to signaled state by the Set method. This nonsignaled state blocks the execution of any threads that have specified this condition object in a call to one of wait methods.

This Reset method is used primarily for a manual-reset condition object, which must be set explicitly to the nonsignaled state. Auto-reset condition objects automatically change from signaled to nonsignaled after a single waiting thread is released.

Parameters
condthis condition object.

◆ Destroy

void(* CMUTIL_Cond::Destroy) (CMUTIL_Cond *cond)

Destroys all resources related to this object.

Parameters
condthis condition object.

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