BeRTOS
Functions
Kernel signals
Kernel facilities

Signal module for IPC. More...

Functions

sigmask_t sig_checkSignal (Signal *s, sigmask_t sigs)
 Check if any of the signals in sigs has occurred and clear them.
sigmask_t sig_check (sigmask_t sigs)
 Check if any of the signals in sigs has occurred and clear them.
void sig_send (Process *proc, sigmask_t sig)
 Send the signals sigs to the process proc and immeditaly dispatch it for execution.
void sig_post (Process *proc, sigmask_t sig)
 Send the signals sigs to the process proc.
sigmask_t sig_wait (sigmask_t sigs)
 Sleep until any of the signals in sigs occurs.
sigmask_t sig_waitTimeout (sigmask_t sigs, ticks_t timeout)
 Sleep until any of the signals in sigs or timeout ticks elapse.

Signal definitions

#define SIG_USER0   BV(0)
 Free for user usage.
#define SIG_USER1   BV(1)
 Free for user usage.
#define SIG_USER2   BV(2)
 Free for user usage.
#define SIG_USER3   BV(3)
 Free for user usage.
#define SIG_SINGLE   BV(4)
 Used to wait for a single event.
#define SIG_SYSTEM5   BV(5)
 Reserved for internal system use.
#define SIG_SYSTEM6   BV(6)
 Reserved for internal system use.
#define SIG_TIMEOUT   BV(7)
 Reserved for timeout use.
#define SIG_USER_MAX   SIG_SINGLE
 Max number of signals that can be used by drivers or user applications.

Detailed Description

Signal module for IPC.

Author:
Bernie Innocenti <bernie@codewiz.org>

Function Documentation

sigmask_t sig_check ( sigmask_t  sigs) [inline]

Check if any of the signals in sigs has occurred and clear them.

Returns:
the signals that have occurred.

Definition at line 92 of file signal.h.

sigmask_t sig_checkSignal ( Signal s,
sigmask_t  sigs 
) [inline]

Check if any of the signals in sigs has occurred and clear them.

Returns:
the signals that have occurred.

Definition at line 75 of file signal.h.

void sig_post ( Process *  proc,
sigmask_t  sig 
) [inline]

Send the signals sigs to the process proc.

The process will be awoken if it was waiting for any of them.

Note:
This call is interrupt safe.

Definition at line 123 of file signal.h.

void sig_send ( Process *  proc,
sigmask_t  sig 
) [inline]

Send the signals sigs to the process proc and immeditaly dispatch it for execution.

The process will be awoken if it was waiting for any of them and immediately dispatched for execution.

Note:
This function can't be called from IRQ context, use sig_post() instead.

Definition at line 110 of file signal.h.

sigmask_t sig_wait ( sigmask_t  sigs) [inline]

Sleep until any of the signals in sigs occurs.

Returns:
the signal(s) that have awoken the process.

Definition at line 144 of file signal.h.

sigmask_t sig_waitTimeout ( sigmask_t  sigs,
ticks_t  timeout 
) [inline]

Sleep until any of the signals in sigs or timeout ticks elapse.

If the timeout elapse a SIG_TIMEOUT is added to the received signal(s).

Returns:
the signal(s) that have awoken the process.
Note:
Caller must check return value to check which signal awoke the process.

Definition at line 159 of file signal.h.