06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

pSOS+ <strong>System</strong> <strong>Calls</strong> as_catch<br />

as_catch Specifies an asynchronous signal routine (ASR).<br />

#include <br />

unsigned long as_catch(<br />

void (* start_addr) (), /* ASR address */<br />

unsigned long mode /* ASR attributes */<br />

)<br />

Description<br />

Arguments<br />

This system call allows a task to specify an asynchronous signal routine (ASR) to<br />

handle asynchronous signals. as_catch() supplies the starting address of the<br />

task's ASR, and its initial execution mode. If the input ASR address is zero, then the<br />

caller is deemed to have an invalid ASR, and any signals sent to it will be rejected.<br />

A task's ASR gains control much like an ISR. If a task has pending signals (sent via<br />

as_send()), then the next time the task is dispatched to run, it will be forced to<br />

first execute the task's specified ASR. A task executes its ASR according to the mode<br />

supplied by the as_catch() call (for example, Non-preemptible, Time-slicing<br />

enabled, etc.) Upon entry to the ASR, all pending signals — including all those<br />

received since the last ASR invocation — are passed as an argument to the ASR. In<br />

addition, a stack frame is built to facilitate the return from the ASR.<br />

as_catch() replaces any previous ASR for the calling task. Therefore, a task can<br />

have only one ASR at any time. An ASR must exit using the as_return() system<br />

call.<br />

start_addr Specifies the address of the ASR.<br />

mode Specifies the ASR's attributes. mode is formed by OR-ing the<br />

following symbolic constants (one from each pair), which are<br />

defined in . For instance, to specify that the ASR should<br />

have preemption turned off, you place the symbolic constant<br />

T_NOPREEMPT in mode. To specify that the ASR should have<br />

preemption turned off and roundrobin by time-slicing turned on,<br />

you place both T_NOPREEMPT and T_TSLICE in mode, using the<br />

following syntax:<br />

T_NOPREEMPT | T_TSLICE<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 1-3<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!