Go to the source code of this file.
Macros | |
#define | LE_MUTEX_DECLARE_REF(refName) |
Typedefs | |
typedef struct le_mutex * | le_mutex_Ref_t |
Functions | |
le_mutex_Ref_t | le_mutex_CreateRecursive (const char *nameStr) |
le_mutex_Ref_t | le_mutex_CreateNonRecursive (const char *nameStr) |
void | le_mutex_Delete (le_mutex_Ref_t mutexRef) |
void | le_mutex_Lock (le_mutex_Ref_t mutexRef) |
le_result_t | le_mutex_TryLock (le_mutex_Ref_t mutexRef) |
void | le_mutex_Unlock (le_mutex_Ref_t mutexRef) |
Legato Mutex API include file.
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
#define LE_MUTEX_DECLARE_REF | ( | refName | ) |
Declare a static mutex reference variable and accessor functions.
This is handy when you need a single, file-scope mutex for use inside your module to protect other file-scope data structures from multi-threaded race conditions.
Adding the line
near the top of your file will create a file-scope variable called "MyMutexRef" of type le_mutex_Ref_t and functions called "Lock" and "Unlock" that access that variable.
See c_mutex_locking_tips for more information.
refName | Name of the mutex reference variable. |
typedef struct le_mutex* le_mutex_Ref_t |
Reference to a Mutex object.
le_mutex_Ref_t le_mutex_CreateNonRecursive | ( | const char * | nameStr | ) |
Create a Normal, Non-Recursive mutex.
[in] | nameStr | Name of the mutex |
le_mutex_Ref_t le_mutex_CreateRecursive | ( | const char * | nameStr | ) |
Create a Normal, Recursive mutex.
[in] | nameStr | Name of the mutex |
void le_mutex_Delete | ( | le_mutex_Ref_t | mutexRef | ) |
Delete a mutex.
[in] | mutexRef | Mutex reference |
void le_mutex_Lock | ( | le_mutex_Ref_t | mutexRef | ) |
Lock a mutex.
[in] | mutexRef | Mutex reference |
le_result_t le_mutex_TryLock | ( | le_mutex_Ref_t | mutexRef | ) |
Try a lock on a mutex.
Locks a mutex, if no other thread holds it. Otherwise, returns without locking.
[in] | mutexRef | Mutex reference |
void le_mutex_Unlock | ( | le_mutex_Ref_t | mutexRef | ) |
Unlock a mutex.
[in] | mutexRef | Mutex reference |