tk_dis_dsp

Disable Dispatch

[C Language Interface]

ER ercd = tk_dis_dsp ( ) ;

[Parameters]

None

[Return Parameters]

ER	ercd	Error code

[Error Codes]

E_OK	Normal completion


E_CTX	Context error (issued from task-independent portion)

[Description]

Disables task dispatching. Dispatch disabled state remains in effect until tk_ena_dsp is called to enable task dispatching. While dispatching is disabled, the invoking task does not change from RUN state to READY state or to WAIT state. External interrupts, however, are still enabled, so even in dispatch disabled state an interrupt handler can be started. In dispatch disabled state, the running task can be preempted by an interrupt handler, but not by another task.

The specific operations during dispatch disabled state are as follows.

  • Even if a system call issued from an interrupt handler or by the task that called tk_dis_dsp results in a task going to READY state with a higher priority than the task that called tk_dis_dsp, that task will not be dispatched. Dispatching of the higher-priority task is delayed until dispatch disabled state ends.
  • If the task that called tk_dis_dsp issues a system call that may cause the invoking task to be put in WAIT state (e.g., tk_slp_tsk or tk_wai_sem), error code E_CTX is returned to it.
  • When system status is referenced by tk_ref_sys, TSS_DDSP is returned in sysstat.

If tk_dis_dsp is called for a task already in dispatch disabled state, that state continues with no error code returned. No matter how many times tk_dis_dsp is called, calling tk_ena_dsp just once is sufficient to enable dispatching again. The operation when the pair of system calls tk_dis_dsp and tk_ena_dsp are nested must therefore be managed by the user as required.

[Additional Notes]

A task in RUN state cannot go to DORMANT state or NON-EXISTENT state while dispatching is disabled. If tk_ext_tsk or tk_exd_tsk is called for a task in RUN state while interrupts or dispatching is disabled, error code E_CTX is detected. Since, however, tk_ext_tsk and tk_exd_tsk are system calls that do not return to their original context, such errors are not passed in return parameters by these system calls.

Use of dispatch disabled state for mutual exclusion control among tasks is possible only if the system does not have a multiprocessor configuration.

Comments

Click here to Post a Comment