PinCRT
|
Classes | |
struct | _OS_APIS_MUTEX_TYPE |
Macros | |
#define | OS_APIS_MUTEX_DEPTH_SIMPLE_INITIALIZER |
#define | OS_APIS_MUTEX_DEPTH_RECURSIVE_INITIALIZER |
Typedefs | |
typedef struct _OS_APIS_MUTEX_TYPE | OS_MUTEX_TYPE_IMPL |
Functions | |
void | OS_MutexInit (volatile OS_MUTEX_TYPE *lock) |
void | OS_MutexRecursiveInit (volatile OS_MUTEX_TYPE *lock) |
void | OS_MutexDestroy (volatile OS_MUTEX_TYPE *lock) |
void | OS_MutexLock (volatile OS_MUTEX_TYPE *lock) |
void | OS_MutexLockTid (volatile OS_MUTEX_TYPE *lock, NATIVE_TID myTid) |
BOOL_T | OS_MutexTryLock (volatile OS_MUTEX_TYPE *lock) |
BOOL_T | OS_MutexTryLockTid (volatile OS_MUTEX_TYPE *lock0, NATIVE_TID myTid) |
BOOL_T | OS_MutexIsLocked (volatile OS_MUTEX_TYPE *lock) |
BOOL_T | OS_MutexTimedLock (volatile OS_MUTEX_TYPE *lock, UINT32 timeoutMillis) |
BOOL_T | OS_MutexTimedLockTid (volatile OS_MUTEX_TYPE *lock0, NATIVE_TID myTid, UINT32 timeoutMillis) |
NATIVE_TID | OS_MutexGetOwner (volatile OS_MUTEX_TYPE *lock) |
UINT32 | OS_MutexGetRecursionLevel (volatile OS_MUTEX_TYPE *lock) |
BOOL_T | OS_MutexUnlock (volatile OS_MUTEX_TYPE *lock) |
#define OS_APIS_MUTEX_DEPTH_RECURSIVE_INITIALIZER |
Static initializer for a mutex. It is guaranteed that a (recursive) mutex initialized this way:
OS_MUTEX_TYPE mutex = OS_APIS_MUTEX_DEPTH_SIMPLE_INITIALIZER;
Will be initialized before any constuctor will be called.
#define OS_APIS_MUTEX_DEPTH_SIMPLE_INITIALIZER |
Static initializer for a mutex. It is guaranteed that a (simple) mutex initialized this way:
OS_MUTEX_TYPE mutex = OS_APIS_MUTEX_DEPTH_SIMPLE_INITIALIZER;
Will be initialized before any constuctor will be called. Also, the static initializer for a simple mutex must be all zeros. This is because we want mutex that is initialized in a default way (all zeros according to the C++ standard) will be initialized correctly to a simple mutex.
typedef struct _OS_APIS_MUTEX_TYPE OS_MUTEX_TYPE_IMPL |
This type holds a representation of a mutex.
void OS_MutexDestroy | ( | volatile OS_MUTEX_TYPE * | lock | ) |
Destroys a mutex after it is no longer in use.
[in] | lock | The mutex to destroy. |
NATIVE_TID OS_MutexGetOwner | ( | volatile OS_MUTEX_TYPE * | lock | ) |
Queries the owner of a recursive mutex.
[in] | lock | The mutex to query. |
NATIVE_TID | The owner of the mutex of INVALID_NATIVE_TID is the mutex is not locked. |
UINT32 OS_MutexGetRecursionLevel | ( | volatile OS_MUTEX_TYPE * | lock | ) |
Queries the recursion of a recursive mutex. I.e. the number of times that the unlock functions needs to be called before the mutex can be acquired by other thread.
[in] | lock | The mutex to query. |
UINT32 | The recursion level of the mutex. |
void OS_MutexInit | ( | volatile OS_MUTEX_TYPE * | lock | ) |
Initialize a mutex. A mutex must be initialized before being used. Use this function to initialize the mutex or use one of the static initializers.
[in] | lock | The mutex to initialize. |
BOOL_T OS_MutexIsLocked | ( | volatile OS_MUTEX_TYPE * | lock | ) |
Checks whether a mutex state is locked.
Doesn't affect the mutex state and doesn't block.
[in] | lock | The mutex to check. |
TRUE | If the mutex is locked. |
void OS_MutexLock | ( | volatile OS_MUTEX_TYPE * | lock | ) |
Aquire a mutex, blocks until the mutex becomes available (according to the mutex's semantics).
[in] | lock | The mutex to acquire. |
void OS_MutexLockTid | ( | volatile OS_MUTEX_TYPE * | lock, |
NATIVE_TID | myTid | ||
) |
Aquire a mutex, blocks until the mutex becomes available (according to the mutex's semantics). This function is similar to OS_MutexLock() except that it accept as an argument the thread ID of the thread that want to acquire the lock (which is usually the current thread).
[in] | lock | The mutex to acquire. |
[in] | tid | The thread ID of the thread that wants to acquire the mutex. This argument can be INVALID_NATIVE_TID if the thread ID is not known (e.g. in a mutex of type OS_MUTEX_DEPTH_SIMPLE). |
void OS_MutexRecursiveInit | ( | volatile OS_MUTEX_TYPE * | lock | ) |
Initialize a recursive mutex. A mutex must be initialized before being used. Use this function to initialize a recursive mutex or use one of the static initializers.
[in] | lock | The mutex to initialize. |
BOOL_T OS_MutexTimedLock | ( | volatile OS_MUTEX_TYPE * | lock, |
UINT32 | timeoutMillis | ||
) |
Aquire a mutex, blocks until the mutex becomes available (according to the mutex's semantics). or 'timeoutMillis' milli seconds passed. When 'timeoutMillis' is zero, this function is identical to OS_MutexTryLock().
[in] | lock | The mutex to acquire. |
[in] | timeoutMillis | The timeout to block. |
TRUE | If the mutex is locked. FALSE If the timeout was expired and the mutex can't be acquired during that time. |
BOOL_T OS_MutexTimedLockTid | ( | volatile OS_MUTEX_TYPE * | lock0, |
NATIVE_TID | myTid, | ||
UINT32 | timeoutMillis | ||
) |
Aquire a mutex, blocks until the mutex becomes available (according to the mutex's semantics). or 'timeoutMillis' milli seconds passed. When 'timeoutMillis' is zero, this function is identical to OS_MutexTryLock(). This function is similar to OS_MutexTimedLock() except that it accept as an argument the thread ID of the thread that want to acquire the lock (which is usually the current thread).
[in] | lock | The mutex to acquire. |
[in] | timeoutMillis | The timeout to block. |
[in] | tid | The thread ID of the thread that wants to acquire the mutex. This argument can be INVALID_NATIVE_TID if the thread ID is not known (e.g. in a mutex of type OS_MUTEX_DEPTH_SIMPLE). |
TRUE | If the mutex is locked. FALSE If the timeout was expired and the mutex can't be acquired during that time. |
BOOL_T OS_MutexTryLock | ( | volatile OS_MUTEX_TYPE * | lock | ) |
Tries to aquire a mutex:
[in] | lock | The mutex to acquire. |
TRUE | If the mutex was acquired. |
BOOL_T OS_MutexTryLockTid | ( | volatile OS_MUTEX_TYPE * | lock0, |
NATIVE_TID | myTid | ||
) |
Tries to aquire a mutex:
[in] | lock | The mutex to acquire. |
[in] | tid | The thread ID of the thread that wants to acquire the mutex. This argument can be INVALID_NATIVE_TID if the thread ID is not known (e.g. in a mutex of type OS_MUTEX_DEPTH_SIMPLE). |
TRUE | If the mutex was acquired. |
BOOL_T OS_MutexUnlock | ( | volatile OS_MUTEX_TYPE * | lock | ) |
Releases a mutex.
[in] | lock | The mutex to release. |
TRUE | If the mutex was locked and as a result of this call was unlocked. |