C Microkernel Realtime eXecutive
Realtime Operating System for Cortex-M based microcontrollers
 
Loading...
Searching...
No Matches
Signals

Description

API for sending signals and handling incoming signals.

Threads can send signals asynchronously to each other. Kernel provides mechanism to register signal handler, which gets executed whenever thread receives a signal. There are two kinds of signals:

  • catchable - kernel supports sending of 32 distinct catchable signals. Kernel doesn't interpret any of them in any way. If such signal is sent to the thread then thread is simply notified of its arrival.
  • non-catchable - these signals are mostly system-defined and thread is not able to catch nor react to them. These include stopping and resuming thread, killing it and signalling memory protection violation error.

If thread doesn't register any signal handler, then signal arrival is effectively a no-op for given thread. In any case, arrival of signal will wake thread up, if it is stopped.

__SYSCALL int signal (int signo, void(*sighandler)(uint32_t))
 Register function as current thread signal handler.
 
__SYSCALL int kill (int thread, uint32_t signal)
 Send thread a signal.
 
#define SIGALRM   0
 
#define SIGKILL   32
 
#define SIGSTOP   33
 
#define SIGCONT   34
 
#define SIGSEGV   35
 

Macro Definition Documentation

◆ SIGALRM

#define SIGALRM   0

◆ SIGCONT

#define SIGCONT   34

◆ SIGKILL

#define SIGKILL   32

◆ SIGSEGV

#define SIGSEGV   35

◆ SIGSTOP

#define SIGSTOP   33

Function Documentation

◆ kill()

__SYSCALL int kill ( int  thread,
uint32_t  signal 
)

Send thread a signal.

Send a signal to the thread.

Parameters
threadrecipient thread id
signalsignal number
Returns
0. Mostly.

◆ signal()

__SYSCALL int signal ( int  signo,
void(*)(uint32_t)  sighandler 
)

Register function as current thread signal handler.

Parameters
signonumber of signal
sighandleraddress of function which handles the signal
Returns
0. Mostly.