<< Previous | Next >>

OSQDel

OS_EVENT * OSQDel( OS_EVENT * pevent, INT8U opt, INT8U * err );

Description

Deletes a message queue and readies all tasks pending on the queue. Note that:

  • This function must be used with care. Tasks that would normally expect the presence of the queue MUST check the return code of OSQPend().

  • OSQAccept() callers will not know that the intended queue has been deleted unless they check pevent to see that it's a null pointer.

  • This call can potentially disable interrupts for a long time. The interrupt disable time is directly proportional to the number of tasks waiting on the queue.

  • Because all tasks pending on the queue will be readied, you must be careful in applications where the queue is used for mutual exclusion because the resource(s) will no longer be guarded by the queue.

  • If the storage for the message queue was allocated dynamically (i.e., using a malloc() type call) then your application must release the memory storage by call the counterpart call of the dynamic allocation scheme used. If the queue storage was created statically then, the storage can be reused.

Parameters

pevent
Pointer to the queue's event control block.

opt
May be one of the following delete options:

  • OS_DEL_NO_PEND - Delete queue only if no task pending

  • OS_DEL_ALWAYS - Deletes the queue even if tasks are waiting. In this case, all the tasks pending will be readied.

err
Pointer to an error code that can contain one of the following:

  • OS_NO_ERR - Call was successful and queue was deleted

  • OS_ERR_DEL_ISR - Attempt to delete queue from an ISR

  • OS_ERR_INVALID_OPT - Invalid option was specified

  • OS_ERR_TASK_WAITING - One or more tasks were waiting on the queue

  • OS_ERR_EVENT_TYPE - You didn't pass a pointer to a queue

  • OS_ERR_PEVENT_NULL - If pevent is a null pointer.

Return value

pevent
Error

(OS_EVENT *)0
The queue was successfully deleted.

Library

OS_Q.C (Prior to DC 8:UCOS2.LIB)


Dynamic C Functions << Previous | Next >> rabbit.com