agileRTOS (zrtos)  Version 0.8.0 (ghostbuster)
task_mutex.h File Reference
#include <zrtos/zrtos.h>
#include <zrtos/error.h>
Include dependency graph for task_mutex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _zrtos_task_mutex_t
 

Macros

#define ZRTOS_TASK_MUTEX__INITIALIZER   {.is_locked = 0}
 

Typedefs

typedef struct _zrtos_task_mutex_t zrtos_task_mutex_t
 

Functions

bool zrtos_task_mutex__init (zrtos_task_mutex_t *thiz)
 
void zrtos_task_mutex__deinit (zrtos_task_mutex_t *thiz)
 
int zrtos_task_mutex__try_lock (zrtos_task_mutex_t *thiz)
 
int zrtos_task_mutex__lock (zrtos_task_mutex_t *thiz)
 
int zrtos_task_mutex__unlock (zrtos_task_mutex_t *thiz)
 

Macro Definition Documentation

◆ ZRTOS_TASK_MUTEX__INITIALIZER

#define ZRTOS_TASK_MUTEX__INITIALIZER   {.is_locked = 0}

Definition at line 22 of file task_mutex.h.

Typedef Documentation

◆ zrtos_task_mutex_t

Function Documentation

◆ zrtos_task_mutex__deinit()

void zrtos_task_mutex__deinit ( zrtos_task_mutex_t thiz)

Definition at line 29 of file task_mutex.h.

29  {
30 
31 }
Here is the caller graph for this function:

◆ zrtos_task_mutex__init()

bool zrtos_task_mutex__init ( zrtos_task_mutex_t thiz)

Definition at line 24 of file task_mutex.h.

24  {
25  thiz->is_locked = false;
26  return true;
27 }
Here is the caller graph for this function:

◆ zrtos_task_mutex__lock()

int zrtos_task_mutex__lock ( zrtos_task_mutex_t thiz)

Definition at line 44 of file task_mutex.h.

44  {
45  bool ret = true;
46  bool is_locked;
47  uint8_t limit = 0xFF;
48  do{
50  if(thiz->is_locked == false){
51  thiz->is_locked = true;
52  ret = false;
53  }
54  });
55  if(ret){
57  }
58  }while(ret && !is_locked && limit--);
59  return ret;
60 }
#define ZRTOS_TASK_SCHEDULER__DO_NOT_DISTURB_EX(is_locked, code)
void zrtos_task_scheduler__delay_ms(zrtos_task_tick_t ms)
static uint8_t
Definition: mcp2515.h:159
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_task_mutex__try_lock()

int zrtos_task_mutex__try_lock ( zrtos_task_mutex_t thiz)

Definition at line 33 of file task_mutex.h.

33  {
34  int ret = ZRTOS_ERROR__BUSY;
36  if(thiz->is_locked == false){
37  thiz->is_locked = true;
38  ret = 0;
39  }
40  });
41  return ret;
42 }
#define ZRTOS_TASK_SCHEDULER__DO_NOT_DISTURB(code)
Device or resource busy.
Definition: error.h:40
Here is the caller graph for this function:

◆ zrtos_task_mutex__unlock()

int zrtos_task_mutex__unlock ( zrtos_task_mutex_t thiz)

Definition at line 62 of file task_mutex.h.

62  {
64  thiz->is_locked = false;
65  });
66  return 0;
67 }
#define ZRTOS_TASK_SCHEDULER__DO_NOT_DISTURB(code)
Here is the caller graph for this function: