tk_slp_tsk
Sleep Task
See Also
ER ercd = tk_slp_tsk ( TMO tmout ) ;
TMO tmout Timeout
ER ercd Error code
E_OK Normal completion
E_PAR Parameter error (tmout less than or equal to (-2))
E_RLWAI Wait state released (tk_rel_wai received in wait state)
E_TMOUT Polling failed or timeout
E_CTX Context error (issued from task-independent portion or in dispatch disabled state)
Changes the state of the invoking task from RUN state to sleep state [WAIT for tk_wup_tsk]
If tk_wup_tsk is issued for the invoking task before the time specified in tmout has elapsed, this system call completes normally. If timeout occurs before tk_wup_tsk is issued, error code E_TMOUT is returned.
Specifying tmout = TMO_FEVR =(-1) means endless wait. In this case, the task stays in waiting state until tk_wup_tsk is issued.
Since tk_slp_tsk is a system call that puts the invoking task into a wait state, tk_slp_tsk can never be nested. It is possible, however, for another task to issue tk_sus_tsk for a task that was put in a wait state by tk_slp_tsk. In this case, the task goes to WAIT-SUSPEND state.
For simply delaying a task, tk_dly_tsk should be used rather than tk_slp_tsk. The task sleep function is intended for use by applications and as a rule should not be used by middleware. The reason is that attempting to achieve synchronization by putting a task to sleep in two or more places would cause confusion, leading to mis-operation. For example, if sleep were used by both an application and middleware for synchronization, a wakeup request might arise in the application while middleware has the task sleeping. In such a situation, normal operation would not be possible in either the application or middleware. Proper task synchronization is not possible because it is not clear where the wait for wakeup originated. Task sleep is often used as a simple means of task synchronization. Applications should be able to use it freely, which means, as a rule, it should not be used by middleware.
E_DISWAI does not exist in error codes. This is because in µT-Kernel, there is no wait-disabled function.

Comments
Click here to Post a Comment