signal.h File Reference

Signal module for IPC. More...

#include <cfg/compiler.h>
#include <cfg/macros.h>

Go to the source code of this file.

Defines

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_TIMEOUT   BV(4)
 Reserved for timeout use.
#define SIG_SYSTEM5   BV(5)
 Reserved for system use.
#define SIG_SYSTEM6   BV(6)
 Reserved for system use.
#define SIG_SINGLE   BV(7)
 Used to wait for a single event.

Functions

sigmask_t sig_check (sigmask_t sigs)
 Check if any of the signals in sigs has occurred and clear them.
void sig_send (struct Process *proc, sigmask_t sig)
 Send the signals sigs to the process proc and immeditaly dispatch it for execution.
void sig_post (struct 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.

Detailed Description

Signal module for IPC.

Version:
Id
signal.h 3269 2010-03-25 14:56:23Z arighi
Author:
Bernie Innocenti <bernie@codewiz.org>

Definition in file signal.h.


Function Documentation

sigmask_t sig_check ( sigmask_t  sigs  ) 

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

Returns:
the signals that have occurred.

Definition at line 150 of file signal.c.

void sig_post ( Process *  proc,
sigmask_t  sigs 
)

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 298 of file signal.c.

void sig_send ( Process *  proc,
sigmask_t  sigs 
)

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 283 of file signal.c.

sigmask_t sig_wait ( sigmask_t  sigs  ) 

Sleep until any of the signals in sigs occurs.

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

Definition at line 168 of file signal.c.

sigmask_t sig_waitTimeout ( sigmask_t  sigs,
ticks_t  timeout 
)

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 224 of file signal.c.