Download µC/OS-III Users Manual
Transcript
Appendix A OSQDel() OS_OBJ_QTY OSQDel (OS_Q *p_q, OS_OPT opt, OS_ERR *p_err) File Called from Code enabled by OS_Q.C Task OS_CFG_Q_EN and OS_CFG_Q_DEL_EN OSQDel() is used to delete a message queue. This function should be used with care since multiple tasks may rely on the presence of the message queue. Generally speaking, before deleting a message queue, first delete all the tasks that can access the message queue. However, it is highly recommended that you do not delete kernel objects at run time. Arguments p_q is a pointer to the message queue to delete. opt specifies whether to delete the queue only if there are no pending tasks (OS_OPT_DEL_NO_PEND), or always delete the queue regardless of whether tasks are pending or not (OS_OPT_DEL_ALWAYS). In this case, all pending task are readied. p_err is a pointer to a variable that is used to hold an error code. The error code can be one of the following: OS_ERR_NONE OS_ERR_DEL_ISR OS_ERR_OBJ_PTR_NULL OS_ERR_OBJ_TYPE OS_ERR_OPT_INVALID OS_ERR_TASK_WAITING 438 if the call is successful and the message queue has been deleted. if the user attempts to delete the message queue from an ISR. if passing a NULL pointer for p_q. if p_q is not pointing to a queue. if not specifying one of the two options mentioned in the opt argument. if one or more tasks are waiting for messages at the message queue and it is specified to only delete if no task is pending.