Defines an interface for condition variables.
Enumeration of possible results from waiting on a condvar.
Values
kSbConditionVariableSignaled
- The wait completed because the condition variable was signaled.kSbConditionVariableTimedOut
- The wait completed because it timed out, and was not signaled.kSbConditionVariableFailed
- The wait failed, either because a parameter wasn't valid, or the conditionvariable has already been destroyed, or something similar.Description
Broadcasts to all current waiters of condition
to stop waiting. This function wakes all of the threads waiting on condition
while SbConditionVariableSignal wakes a single thread.
Declaration and definitions
#include "starboard/condition_variable.h" bool SbConditionVariableBroadcast(SbConditionVariable* /*condition*/) { return false; }
Parameters
Description
Creates a new condition variable to work with opt_mutex
, which may be null, placing the newly created condition variable in out_condition
.
The return value indicates whether the condition variable could be created.
Declaration and definitions
#include "starboard/condition_variable.h" bool SbConditionVariableCreate(SbConditionVariable* /*out_condition*/, SbMutex* /*opt_mutex*/) { return false; }
Parameters
Description
Destroys the specified SbConditionVariable. The return value indicates whether the destruction was successful. The behavior is undefined if other threads are currently waiting on this condition variable.
Declaration and definitions
#include "starboard/condition_variable.h" bool SbConditionVariableDestroy(SbConditionVariable* /*condition*/) { return false; }
Parameters
Description
Returns whether the given result is a success.
Declaration
static SB_C_INLINE bool SbConditionVariableIsSignaled( SbConditionVariableResult result) { return result == kSbConditionVariableSignaled; }
Parameters
Description
Signals the next waiter of condition
to stop waiting. This function wakes a single thread waiting on condition
while SbConditionVariableBroadcast wakes all threads waiting on it.
Declaration and definitions
#include "starboard/condition_variable.h" bool SbConditionVariableSignal(SbConditionVariable* /*condition*/) { return false; }
Parameters
Description
Waits for condition
, releasing the held lock mutex
, blocking indefinitely, and returning the result. Behavior is undefined if mutex
is not held.
Declaration and definitions
#include "starboard/condition_variable.h" SbConditionVariableResult SbConditionVariableWait( SbConditionVariable* /*condition*/, SbMutex* /*mutex*/) { return kSbConditionVariableFailed; }
Parameters
Description
Waits for condition
, releasing the held lock mutex
, blocking up to timeout_duration
, and returning the acquisition result. Behavior is undefined if mutex
is not held.
Declaration and definitions
#include "starboard/condition_variable.h" SbConditionVariableResult SbConditionVariableWaitTimed( SbConditionVariable* /*condition*/, SbMutex* /*mutex*/, SbTime /*timeout*/) { return kSbConditionVariableFailed; }
Parameters