ChibiOS  21.6.0
Delegate Threads
Collaboration diagram for Delegate Threads:

Detailed Description

Typedefs

typedef msg_t(* delegate_veneer_t) (va_list *argsp)
 Type of a delegate veneer function. More...
 
typedef msg_t(* delegate_fn0_t) (void)
 Type of a delegate function with no parameters. More...
 
typedef msg_t(* delegate_fn1_t) (msg_t p1)
 Type of a delegate function with one parameter. More...
 
typedef msg_t(* delegate_fn2_t) (msg_t p1, msg_t p2)
 Type of a delegate function with two parameters. More...
 
typedef msg_t(* delegate_fn3_t) (msg_t p1, msg_t p2, msg_t p3)
 Type of a delegate function with three parameters. More...
 
typedef msg_t(* delegate_fn4_t) (msg_t p1, msg_t p2, msg_t p3, msg_t p4)
 Type of a delegate function with four parameters. More...
 

Functions

msg_t __ch_delegate_fn0 (va_list *argsp)
 Veneer for functions with no parameters. More...
 
msg_t __ch_delegate_fn1 (va_list *argsp)
 Veneer for functions with one parameter. More...
 
msg_t __ch_delegate_fn2 (va_list *argsp)
 Veneer for functions with two parameters. More...
 
msg_t __ch_delegate_fn3 (va_list *argsp)
 Veneer for functions with three parameters. More...
 
msg_t __ch_delegate_fn4 (va_list *argsp)
 Veneer for functions with four parameters. More...
 
msg_t chDelegateCallVeneer (thread_t *tp, delegate_veneer_t veneer,...)
 Triggers a function call on a delegate thread. More...
 
void chDelegateDispatch (void)
 Call messages dispatching. More...
 
msg_t chDelegateDispatchTimeout (sysinterval_t timeout)
 Call messages dispatching with timeout. More...
 
static msg_t chDelegateCallDirect0 (thread_t *tp, delegate_fn0_t func)
 Direct call to a function with no parameters. More...
 
static msg_t chDelegateCallDirect1 (thread_t *tp, delegate_fn1_t func, msg_t p1)
 Direct call to a function with one parameter. More...
 
static msg_t chDelegateCallDirect2 (thread_t *tp, delegate_fn2_t func, msg_t p1, msg_t p2)
 Direct call to a function with two parameters. More...
 
static msg_t chDelegateCallDirect3 (thread_t *tp, delegate_fn3_t func, msg_t p1, msg_t p2, msg_t p3)
 Direct call to a function with three parameters. More...
 
static msg_t chDelegateCallDirect4 (thread_t *tp, delegate_fn4_t func, msg_t p1, msg_t p2, msg_t p3, msg_t p4)
 Direct call to a function with four parameters. More...
 

Typedef Documentation

◆ delegate_veneer_t

typedef msg_t(* delegate_veneer_t) (va_list *argsp)

Type of a delegate veneer function.

Definition at line 60 of file chdelegates.h.

◆ delegate_fn0_t

typedef msg_t(* delegate_fn0_t) (void)

Type of a delegate function with no parameters.

Definition at line 65 of file chdelegates.h.

◆ delegate_fn1_t

typedef msg_t(* delegate_fn1_t) (msg_t p1)

Type of a delegate function with one parameter.

Definition at line 70 of file chdelegates.h.

◆ delegate_fn2_t

typedef msg_t(* delegate_fn2_t) (msg_t p1, msg_t p2)

Type of a delegate function with two parameters.

Definition at line 75 of file chdelegates.h.

◆ delegate_fn3_t

typedef msg_t(* delegate_fn3_t) (msg_t p1, msg_t p2, msg_t p3)

Type of a delegate function with three parameters.

Definition at line 80 of file chdelegates.h.

◆ delegate_fn4_t

typedef msg_t(* delegate_fn4_t) (msg_t p1, msg_t p2, msg_t p3, msg_t p4)

Type of a delegate function with four parameters.

Definition at line 85 of file chdelegates.h.

Function Documentation

◆ __ch_delegate_fn0()

msg_t __ch_delegate_fn0 ( va_list *  argsp)

Veneer for functions with no parameters.

Parameters
[in]argspthe list of arguments
Returns
The function return value.

Definition at line 88 of file chdelegates.c.

Referenced by chDelegateCallDirect0().

◆ __ch_delegate_fn1()

msg_t __ch_delegate_fn1 ( va_list *  argsp)

Veneer for functions with one parameter.

Parameters
[in]argspthe list of arguments
Returns
The function return value.

Definition at line 99 of file chdelegates.c.

Referenced by chDelegateCallDirect1().

◆ __ch_delegate_fn2()

msg_t __ch_delegate_fn2 ( va_list *  argsp)

Veneer for functions with two parameters.

Parameters
[in]argspthe list of arguments
Returns
The function return value.

Definition at line 111 of file chdelegates.c.

Referenced by chDelegateCallDirect2().

◆ __ch_delegate_fn3()

msg_t __ch_delegate_fn3 ( va_list *  argsp)

Veneer for functions with three parameters.

Parameters
[in]argspthe list of arguments
Returns
The function return value.

Definition at line 124 of file chdelegates.c.

Referenced by chDelegateCallDirect3().

◆ __ch_delegate_fn4()

msg_t __ch_delegate_fn4 ( va_list *  argsp)

Veneer for functions with four parameters.

Parameters
[in]argspthe list of arguments
Returns
The function return value.

Definition at line 138 of file chdelegates.c.

Referenced by chDelegateCallDirect4().

◆ chDelegateCallVeneer()

msg_t chDelegateCallVeneer ( thread_t tp,
delegate_veneer_t  veneer,
  ... 
)

Triggers a function call on a delegate thread.

Note
The thread must be executing chDelegateDispatchTimeout() in order to have the functions called.
Parameters
[in]tppointer to the delegate thread
[in]veneerpointer to the veneer function to be called
[in]...variable number of parameters
Returns
The function return value casted to msg_t. It is garbage for functions returning void.

Definition at line 158 of file chdelegates.c.

References chMsgSend().

Referenced by chDelegateCallDirect0(), chDelegateCallDirect1(), chDelegateCallDirect2(), chDelegateCallDirect3(), and chDelegateCallDirect4().

Here is the call graph for this function:

◆ chDelegateDispatch()

void chDelegateDispatch ( void  )

Call messages dispatching.

The function awaits for an incoming call messages and calls the specified functions, then it returns. In case multiple threads are sending messages then the requests are served in priority order.

Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 190 of file chdelegates.c.

References chMsgGet, chMsgRelease(), and chMsgWait().

Here is the call graph for this function:

◆ chDelegateDispatchTimeout()

msg_t chDelegateDispatchTimeout ( sysinterval_t  timeout)

Call messages dispatching with timeout.

The function awaits for an incoming call messages and calls the specified functions, then it returns. In case multiple threads are sending messages then the requests are served in priority order.

Parameters
[in]timeoutthe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_INFINITE no timeout.
Returns
The function outcome.
Return values
MSG_OKif a function has been called.
MSG_TIMEOUTif a timeout occurred.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 219 of file chdelegates.c.

References chMsgGet, chMsgRelease(), chMsgWaitTimeout(), MSG_OK, and MSG_TIMEOUT.

Here is the call graph for this function:

◆ chDelegateCallDirect0()

static msg_t chDelegateCallDirect0 ( thread_t tp,
delegate_fn0_t  func 
)
inlinestatic

Direct call to a function with no parameters.

Note
The return value is assumed to be not larger than a data pointer type. If you need a portable function then use chDelegateCallVeneer() instead.
Parameters
[in]tppointer to the delegate thread
[in]funcpointer to the function to be called
Returns
The function return value as a msg_t.

Definition at line 124 of file chdelegates.h.

References __ch_delegate_fn0(), and chDelegateCallVeneer().

Here is the call graph for this function:

◆ chDelegateCallDirect1()

static msg_t chDelegateCallDirect1 ( thread_t tp,
delegate_fn1_t  func,
msg_t  p1 
)
inlinestatic

Direct call to a function with one parameter.

Note
The return value and parameters are assumed to be not larger than a data pointer type. If you need a portable function then use chDelegateCallVeneer() instead.
Parameters
[in]tppointer to the delegate thread
[in]funcpointer to the function to be called
[in]p1parameter 1 passed as a msg_t
Returns
The function return value as a msg_t.

Definition at line 140 of file chdelegates.h.

References __ch_delegate_fn1(), and chDelegateCallVeneer().

Here is the call graph for this function:

◆ chDelegateCallDirect2()

static msg_t chDelegateCallDirect2 ( thread_t tp,
delegate_fn2_t  func,
msg_t  p1,
msg_t  p2 
)
inlinestatic

Direct call to a function with two parameters.

Note
The return value and parameters are assumed to be not larger than a data pointer type. If you need a portable function then use chDelegateCallVeneer() instead.
Parameters
[in]tppointer to the delegate thread
[in]funcpointer to the function to be called
[in]p1parameter 1 passed as a msg_t
[in]p2parameter 2 passed as a msg_t
Returns
The function return value as a msg_t.

Definition at line 158 of file chdelegates.h.

References __ch_delegate_fn2(), and chDelegateCallVeneer().

Here is the call graph for this function:

◆ chDelegateCallDirect3()

static msg_t chDelegateCallDirect3 ( thread_t tp,
delegate_fn3_t  func,
msg_t  p1,
msg_t  p2,
msg_t  p3 
)
inlinestatic

Direct call to a function with three parameters.

Note
The return value and parameters are assumed to be not larger than a data pointer type. If you need a portable function then use chDelegateCallVeneer() instead.
Parameters
[in]tppointer to the delegate thread
[in]funcpointer to the function to be called
[in]p1parameter 1 passed as a msg_t
[in]p2parameter 2 passed as a msg_t
[in]p3parameter 3 passed as a msg_t
Returns
The function return value as a msg_t.

Definition at line 177 of file chdelegates.h.

References __ch_delegate_fn3(), and chDelegateCallVeneer().

Here is the call graph for this function:

◆ chDelegateCallDirect4()

static msg_t chDelegateCallDirect4 ( thread_t tp,
delegate_fn4_t  func,
msg_t  p1,
msg_t  p2,
msg_t  p3,
msg_t  p4 
)
inlinestatic

Direct call to a function with four parameters.

Note
The return value and parameters are assumed to be not larger than a data pointer type. If you need a portable function then use chDelegateCallVeneer() instead.
Parameters
[in]tppointer to the delegate thread
[in]funcpointer to the function to be called
[in]p1parameter 1 passed as a msg_t
[in]p2parameter 2 passed as a msg_t
[in]p3parameter 3 passed as a msg_t
[in]p4parameter 4 passed as a msg_t
Returns
The function return value as a msg_t.

Definition at line 197 of file chdelegates.h.

References __ch_delegate_fn4(), and chDelegateCallVeneer().

Here is the call graph for this function: