ConOpSys V2970
P004.07
ANVILEX control operating system
|
Functions | |
err_t | sys_mutex_new (sys_mutex_t *mutex) |
void | sys_mutex_lock (sys_mutex_t *mutex) |
void | sys_mutex_unlock (sys_mutex_t *mutex) |
void | sys_mutex_free (sys_mutex_t *mutex) |
int | sys_mutex_valid (sys_mutex_t *mutex) |
void | sys_mutex_set_invalid (sys_mutex_t *mutex) |
Mutexes are recommended to correctly handle priority inversion, especially if you use LWIP_CORE_LOCKING .
void sys_mutex_free | ( | sys_mutex_t * | mutex | ) |
Deallocates a mutex.
mutex | the mutex to delete |
void sys_mutex_lock | ( | sys_mutex_t * | mutex | ) |
Blocks the thread until the mutex can be grabbed.
mutex | the mutex to lock |
Referenced by mem_malloc().
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.
mutex | pointer to the mutex to create |
Referenced by mem_init(), and tcpip_init().
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.
void sys_mutex_unlock | ( | sys_mutex_t * | mutex | ) |
Releases the mutex previously locked through 'sys_mutex_lock()'.
mutex | the mutex to unlock |
Referenced by mem_malloc().
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.