StateOS
Loading...
Searching...
No Matches
Once flag

once flags (one-time call of a function) More...

Macros

#define OS_ONE(one)
 define and initialize a once flag object
#define static_ONE(one)
 static alias of OS_ONE()
#define ONE_INIT()
 create and initialize a once flag object
#define ONE_CREATE()
 create and initialize a once flag object
#define ONE_NEW   ONE_CREATE
 alias of ONE_CREATE()

Typedefs

typedef uint_fast8_t one_t
 once flag

Functions

void one_init (one_t *one)
 initialize a once flag object
void one_call (one_t *one, fun_t *fun)
 try to execute given function

Detailed Description

once flags (one-time call of a function)

Macro Definition Documentation

◆ OS_ONE

#define OS_ONE ( one)
Value:
one_t one[] = { _ONE_INIT() }
uint_fast8_t one_t
once flag
Definition osonceflag.h:48

define and initialize a once flag object

Parameters
onename of a pointer to once flag object

◆ static_ONE

#define static_ONE ( one)
Value:
static one_t one[] = { _ONE_INIT() }

static alias of OS_ONE()

◆ ONE_INIT

#define ONE_INIT ( )
Value:
_ONE_INIT()

create and initialize a once flag object

Returns
once flag object
Note
use only in 'C' code

◆ ONE_CREATE

#define ONE_CREATE ( )
Value:
{ ONE_INIT () }
#define ONE_INIT()
create and initialize a once flag object
Definition osonceflag.h:120

create and initialize a once flag object

Returns
once flag object as array (id)
Note
use only in 'C' code

Function Documentation

◆ one_init()

void one_init ( one_t * one)
inline

initialize a once flag object

Parameters
onepointer to once flag object
Note
use only in thread mode

◆ one_call()

void one_call ( one_t * one,
fun_t * fun )
inline

try to execute given function

     if the once flag has been previously set, the function is not executed

     if the function is being executed by another task, wait for its completion
Parameters
onepointer to once flag object
funpointer to once function
Note
can be used in both thread and handler mode (for blockable interrupts)
in handler mode the function does not wait for completion of the once function
calling one_call with the same once flag from the once function causes a deadlock