tk_dis_dsp
Disable Dispatch
ER ercd = tk_dis_dsp ( ) ;
None
ER ercd Error code
E_OK Normal completion
E_CTX Context error (issued from task-independent portion)
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_dspresults in a task going to READY state with a higher priority than the task that calledtk_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_dspissues a system call that may cause the invoking task to be put in WAIT state (e.g.,tk_slp_tskortk_wai_sem), error codeE_CTXis returned to it. - When system status is referenced by
tk_ref_sys,TSS_DDSPis returned insysstat.
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.
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