Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
Mutexes
[OS abstraction layer]
Mutexes are recommended to correctly handle priority inversion, especially if you use LWIP_CORE_LOCKING . More...
Functions | |
err_t | sys_mutex_new (sys_mutex_t *mutex) |
Create a new mutex. | |
void | sys_mutex_lock (sys_mutex_t *mutex) |
Blocks the thread until the mutex can be grabbed. | |
void | sys_mutex_unlock (sys_mutex_t *mutex) |
Releases the mutex previously locked through 'sys_mutex_lock()'. | |
void | sys_mutex_free (sys_mutex_t *mutex) |
Deallocates a mutex. | |
int | sys_mutex_valid (sys_mutex_t *mutex) |
Returns 1 if the mutes is valid, 0 if it is not valid. | |
void | sys_mutex_set_invalid (sys_mutex_t *mutex) |
Invalidate a mutex so that sys_mutex_valid() returns 0. |
Detailed Description
Mutexes are recommended to correctly handle priority inversion, especially if you use LWIP_CORE_LOCKING .
Function Documentation
void sys_mutex_free | ( | sys_mutex_t * | mutex ) |
Deallocates a mutex.
- Parameters:
-
mutex the mutex to delete
Deallocates a mutex.
- Parameters:
-
mutex the mutex to delete
Definition at line 157 of file sys_arch.c.
void sys_mutex_lock | ( | sys_mutex_t * | mutex ) |
Blocks the thread until the mutex can be grabbed.
- Parameters:
-
mutex the mutex to lock
Blocks the thread until the mutex can be grabbed.
- Parameters:
-
mutex the mutex to lock
Definition at line 173 of file sys_arch.c.
err_t sys_mutex_new | ( | sys_mutex_t * | mutex ) |
Create a new mutex.
Note that mutexes are expected to not be taken recursively by the lwIP code, so both implementation types (recursive or non-recursive) should work. The mutex is allocated to the memory that 'mutex' points to (which can be both a pointer or the actual OS structure). If the mutex has been created, ERR_OK should be returned. Returning any other error will provide a hint what went wrong, but except for assertions, no real error handling is implemented.
- Parameters:
-
mutex pointer to the mutex to create
- Returns:
- ERR_OK if successful, another err_t otherwise
- Parameters:
-
mutex pointer to the mutex to create
- Returns:
- a new mutex
Definition at line 149 of file sys_arch.c.
void sys_mutex_set_invalid | ( | sys_mutex_t * | mutex ) |
Invalidate a mutex so that sys_mutex_valid() returns 0.
ATTENTION: This does NOT mean that the mutex shall be deallocated: sys_mutex_free() is always called before calling this function! This may also be a define, in which case the function is not prototyped.
Definition at line 166 of file sys_arch.c.
void sys_mutex_unlock | ( | sys_mutex_t * | mutex ) |
Releases the mutex previously locked through 'sys_mutex_lock()'.
- Parameters:
-
mutex the mutex to unlock
Releases the mutex previously locked through 'sys_mutex_lock()'.
- Parameters:
-
mutex the mutex to unlock
Definition at line 185 of file sys_arch.c.
int sys_mutex_valid | ( | sys_mutex_t * | mutex ) |
Returns 1 if the mutes is valid, 0 if it is not valid.
When using pointers, a simple way is to check the pointer for != NULL. When directly using OS structures, implementing this may be more complex. This may also be a define, in which case the function is not prototyped.
Generated on Tue Jul 12 2022 13:55:23 by
