lwIP  2.1.0
Lightweight IP stack

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)
 

Detailed Description

Mutexes are recommended to correctly handle priority inversion, especially if you use LWIP_CORE_LOCKING .

Function Documentation

◆ sys_mutex_free()

void sys_mutex_free ( sys_mutex_t *  mutex)

Deallocates a mutex.

Parameters
mutexthe mutex to delete

◆ sys_mutex_lock()

void sys_mutex_lock ( sys_mutex_t *  mutex)

Blocks the thread until the mutex can be grabbed.

Parameters
mutexthe mutex to lock

◆ sys_mutex_new()

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
mutexpointer to the mutex to create
Returns
ERR_OK if successful, another err_t otherwise

◆ sys_mutex_set_invalid()

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.

◆ sys_mutex_unlock()

void sys_mutex_unlock ( sys_mutex_t *  mutex)

Releases the mutex previously locked through 'sys_mutex_lock()'.

Parameters
mutexthe mutex to unlock

◆ sys_mutex_valid()

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.