06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

tm_wkafter Blocks the calling task and wakes it after a specified interval.<br />

#include <br />

unsigned long tm_wkafter(<br />

unsigned long ticks /* clock ticks */<br />

)<br />

Description<br />

Arguments<br />

Return Value<br />

Error Codes<br />

This system call enables the calling task to block unconditionally for a specified<br />

interval. This call resembles self-suspension (t_suspend(0)), except that<br />

tm_wkafter() schedules an automatic resumption after the specified time interval<br />

has lapsed. The interval is in system clock ticks. For example, if the system clock<br />

frequency is 60 ticks per second and the caller requires a pause of 20 seconds, the<br />

input specification should be 60x20 (ticks=1200).<br />

ticks Specifies the number of ticks to elapse during the block.<br />

An interval of n ticks awakens the calling task on the nth next tick. Because<br />

tm_wkafter() can happen anywhere between two ticks, the actual interval is<br />

between n-1 and n ticks.<br />

An interval of 0 ticks has a special function: if no ready tasks have the same priority<br />

as the calling (or running) task, the calling task continues. On the other hand, if one<br />

or more ready tasks with the same priority as the caller exist, the pSOS+ kernel<br />

executes a round-robin by placing the caller behind all ready tasks of the same<br />

priority and giving the CPU to one of those tasks. This provides a manual roundrobin<br />

technique to voluntarily give the CPU to another ready task of the same<br />

priority.<br />

This call always returns 0.<br />

None.<br />

1-180 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

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

Saved successfully!

Ooh no, something went wrong!