30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

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.

194 CHAPTER 4. T-KERNEL/OS FUNCTIONS<br />

tk dis dsp<br />

Disable Dispatch<br />

[C Language Interface]<br />

ER ercd = tk_dis_dsp ( ) ;<br />

[Parameters]<br />

None<br />

[Return Parameters]<br />

ER ercd Error code<br />

[Error Codes]<br />

E OK<br />

E CTX<br />

Normal completion<br />

Context error (issued from task-independent portion)<br />

[Description]<br />

Disables task dispatching. Dispatch disabled state remains in effect until tk ena dsp is called enabling<br />

task dispatching. While dispatching is disabled, the invoking task does not change from RUN state to<br />

READY state or to WAIT state. External interrupts, however, are still enabled, so even in dispatch<br />

disabled state an interrupt handler can be started. In dispatch disabled state, the running task can be<br />

preempted by an interrupt handler, but not by another task.<br />

The specific operations during dispatch disabled state are as follows.<br />

• Even if a system call issued from an interrupt handler or by the task that called tk dis dsp results<br />

in a task going to READY state with a higher priority than the task that called tk dis dsp, that<br />

task will not be dispatched. Dispatching of the higher-priority task is delayed until dispatch<br />

disabled state ends.<br />

• If the task that called tk dis dsp issues a system call that may cause the invoking task to be put<br />

in WAIT state (e.g., tk slp tsk or tk wai sem), error code E CTX is returned.<br />

• When system status is referenced by tk ref sys, TSS DDSP is returned in sysstat.<br />

If tk dis dsp is called for a task already in dispatch disabled state, that state continues with no error<br />

code returned. No matter how many times tk dis dsp is called, calling tk ena dsp just one time<br />

is enough to enable dispatching again. The operation when the pair of system calls tk dis dsp and<br />

tk ena dsp are nested must therefore be managed by the user as necessary.<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

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

Saved successfully!

Ooh no, something went wrong!