Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
Data Structures | Functions
mutex.h File Reference
#include <stdbool.h>
#include <common/list.h>
Include dependency graph for mutex.h:

Go to the source code of this file.

Data Structures

struct  mutex_attr
 
struct  mutex
 
struct  cond
 

Functions

void __mutex_init (struct mutex *mtx)
 
void thread_inherit_priority (struct mutex *mutex)
 
void thread_reset_inherited_priority (struct mutex *mutex)
 
void mutex_init (struct mutex *mtx)
 Initialize the mutex. More...
 
bool mutex_is_locked (struct mutex *mtx)
 Check if the mutex is locked or not. More...
 
int mutex_trylock (struct mutex *mtx)
 Lock the mutex. If the mutex is currently locked then the function shall return immediately. More...
 
int mutex_lock (struct mutex *mtx)
 Lock the mutex. More...
 
int mutex_unlock (struct mutex *mtx)
 Unlock the mutex. More...
 

Function Documentation

◆ mutex_init()

void mutex_init ( struct mutex mtx)

Initialize the mutex.

Parameters
mtxPointer to the mutex.
Return values
None

◆ mutex_is_locked()

bool mutex_is_locked ( struct mutex mtx)

Check if the mutex is locked or not.

Parameters
mtxPointer to the mutex.
Return values
booltrue or false.

◆ mutex_lock()

int mutex_lock ( struct mutex mtx)

Lock the mutex.

Parameters
mtxPointer to the mutex.
Return values
int0 on success and nonzero error number on error.

◆ mutex_trylock()

int mutex_trylock ( struct mutex mtx)

Lock the mutex. If the mutex is currently locked then the function shall return immediately.

Parameters
mtxPointer to the mutex.
Return values
int0 on success and nonzero error number on error.

◆ mutex_unlock()

int mutex_unlock ( struct mutex mtx)

Unlock the mutex.

Parameters
mtxPointer to the mutex.
Return values
int0 on success and nonzero error number on error.