Defines a mutually exclusive lock that can be used to coordinate with other threads.
Enumeration of possible results from acquiring a mutex.
Values
kSbMutexAcquired
- The mutex was acquired successfully.kSbMutexBusy
- The mutex was not acquired because it was held by someone else.kSbMutexDestroyed
- The mutex has already been destroyed.Description
Acquires mutex
, blocking indefinitely. The return value identifies the acquisition result. SbMutexes are not reentrant, so a recursive acquisition blocks forever.
Declaration and definitions
#include "starboard/mutex.h" SbMutexResult SbMutexAcquire(SbMutex* /*mutex*/) { return kSbMutexDestroyed; }
Parameters
Description
Acquires mutex
, without blocking. The return value identifies the acquisition result. SbMutexes are not reentrant, so a recursive acquisition always fails.
Declaration and definitions
#include "starboard/mutex.h" SbMutexResult SbMutexAcquireTry(SbMutex* /*mutex*/) { return kSbMutexDestroyed; }
Parameters
Description
Creates a new mutex. The return value indicates whether the function was able to create a new mutex.
Declaration and definitions
#include "starboard/mutex.h" bool SbMutexCreate(SbMutex* /*mutex*/) { return false; }
Parameters
Description
Destroys a mutex. The return value indicates whether the destruction was successful.
Declaration and definitions
#include "starboard/mutex.h" bool SbMutexDestroy(SbMutex* /*mutex*/) { return false; }
Parameters
Description
Indicates whether the given result is a success. A value of true
indicates that the mutex was acquired.
Declaration
static SB_C_FORCE_INLINE bool SbMutexIsSuccess(SbMutexResult result) { return result == kSbMutexAcquired; }
Parameters
Description
Releases mutex
held by the current thread. The return value indicates whether the release was successful. Releases should always be successful if mutex
is held by the current thread.
Declaration and definitions
#include "starboard/mutex.h" bool SbMutexRelease(SbMutex* /*mutex*/) { return false; }
Parameters