<< Previous | Next >>

OSMboxDel

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

Description

This function deletes a mailbox and readies all tasks pending on the mailbox. Note that:

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

  • OSMboxAccept() callers will not know that the intended mailbox 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 mailbox.

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

Parameters

pevent
Pointer to the event control block associated with the desired mailbox.

opt
May be one of the following delete options:

  • OS_DEL_NO_PEND - Delete mailbox only if no task pending

  • OS_DEL_ALWAYS - Deletes the mailbox 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 values:

  • OS_NO_ERR - Call was successful; mailbox was deleted

  • OS_ERR_DEL_ISR - Attempt to delete mailbox from ISR

  • OS_ERR_INVALID_OPT - Invalid option was specified

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

  • OS_ERR_EVENT_TYPE - No pointer passed to a mailbox

  • OS_ERR_PEVENT_NULL - If pevent is a null pointer.

Return Value

!= (void *)0
Is a pointer to the event control clock (OS_EVENT) associated with the created mailbox

== (void *)0
If no event control blocks were available

Library

OS_MBOX.C


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