tk_dis_wai

Disable Task Wait

[C Language Interface]

INT tskwait = tk_dis_wai ( ID tskid, UINT waitmask ) ;

[Parameters]

ID tskid Task ID

UINT waitmask Task wait disabled setting

[Return Parameters]

INT tskwait Task state after task wait disabled

or Error Code

[Error Codes]

E_OK Normal completion

E_ID Invalid ID number (tskid is invalid or cannot be used)

E_NOEXS Object does not exist (the task specified in tskid does not exist)

E_PAR Parameter error (waitmask is invalid)

[Description]

Disables waits for the wait factors set in waitmask by the task specified in tskid.

If the task is already waiting for a factor specified in waitmask, that wait is released.

waitmask is specified as the logical OR of any combination of the following wait factors.


#define	TTW_SLP	0x00000001	/* Wait caused by sleep	*/
#define	TTW_DLY	0x00000002	/* Wait for task  elay	*/
#define	TTW_SEM	0x00000004	/* Wait for semaphore	*/
#define	TTW_FLG	0x00000008	/* Wait for event flag	*/
#define	TTW_MBX	0x00000040	/* Wait for mailbox	*/
#define	TTW_MTX	0x00000080	/* Wait for mutex	*/
#define	TTW_SMBF	0x00000100	/* Wait for message buffer sending	*/
#define	TTW_RMBF	0x00000200	/* Wait for message buffer receipt	*/
#define	TTW_CAL	0x00000400	/* Wait on rendezvous call	*/
#define	TTW_ACP	0x00000800	/* Wait for rendezvous acceptance	*/
#define	TTW_RDV	0x00001000	/* Wait for rendezvous completion	*/
#define	TTW_MPF	0x00002000	/* Wait for fixed-size memory pool	*/
#define	TTW_MPL	0x00004000	/* Wait for variable-size memory pool	*/
#define	TTW_EV1	0x00010000	/* Wait for task event #1 	*/
#define	TTW_EV2	0x00020000	/* Wait for task event #2	*/
#define	TTW_EV3	0x00040000	/* Wait for task event #3	*/
#define	TTW_EV4	0x00080000	/* Wait for task event #4	*/
#define	TTW_EV5	0x00100000	/* Wait for task event #5	*/
#define	TTW_EV6	0x00200000	/* Wait for task event #6	*/
#define	TTW_EV7	0x00400000	/* Wait for task event #7	*/
#define	TTW_EV8	0x00800000	/* Wait for task event #8	*/
#define	TTX_SVC	0x80000000	/* Extended SVC disabled	*/

TTX_SVC is a special parameter disabling not task wait but the calling of an extended SVC. If TTX_SVC is specified when a task attempts to call an extended SVC, E_DISWAI is returned without calling the extended SVC. This parameter does not have the e.ect of terminating an already called extended SVC. A tskwait value of 0 means the task has not entered WAIT state (or the wait was released). If tskwait is not 0, this means the task is in WAIT state for a cause other than those disabled in waitmask.

When a task wait is cleared by tk_dis_wai or the task is prevented from entering WAIT state while this system call is in e.ect, E_DISWAI is returned. When a system call for which there is the possibility of entering a WAIT state is invoked during wait disabled state, E_DISWAI is returned even if the processing could be performed without waiting.

For example, even if message buffer space is available when tk_snd_mbf is called and message buffer sending is possible without entering a WAIT state, E_DISWAI is returned and the message is not sent. A wait disable set while an extended SVC is executing will be cleared automatically upon return from the extended SVC to its caller. It is automatically cleared also when an extended SVC is called, reverting to the original setting upon return from the extended SVC. A wait disable setting is cleared also when the task reverts to DORMANT state. The setting made while a task is in DORMANT state, however, is valid and the wait disable is applied the next time the task is started.

In the case of semaphores and most other objects, TA_NODISWAI can be specified when the object is created. An object created with TA_NODISWAI specified cannot have waits disabled, and rejects any wait disable attempt by tk_dis_wai.

The invoking task can be specified by setting tskid = TSK_SELF = 0. Note, however, that when a system call is issued from a task-independent portion and tskid = TSK_SELF = 0 is specified, error code E_ID is returned.

[Additional Notes]

The wait disable function is provided for preventing execution of an extended SVC handler and is for use mainly (though not exclusively) in break functions.

Wait disable in the case of a rendezvous is more complex than other cases. Essentially, wait disabled state is detected based on a change in the rendezvous wait state, then the wait is released. Some specific examples are given here.

When waiting by TTW_CAL is not disabled but TTW_RDV waits are disabled, a task enters into wait on rendezvous call state; but when the rendezvous is accepted and a wait for rendezvous completion would normally begin, the wait is released and E_DISWAI is returned. At this time a message is sent to the receiving task, the receiving task declares acceptance of the message and the task goes to rendezvous established state. Only when the accepting task replies (tk_rpl_rdv) does it become clear that there is no other task in the rendezvous, and error code E_OBJ is returned. Wait disable applies also when a rendezvous is forwarded. In that case the attribute of the destination rendezvous port applies. That is, if the TA_NODISWAI attribute is specified for the destination port, wait disable is rejected. If TTW_CAL wait is disabled after going to wait for rendezvous completion state, and a rendezvous is forwarded in that state, the state goes to WAIT on rendezvous call as a result of the forwarding, so wait is disabled by TTW_CAL. In that case E_DISWAI is returned to both the rendezvous calling task (tk_cal_por) and forwarding task (tk_fwd_por).

Comments