PxMbxRelease()

Release a mailbox object.

APPLIES TO

8.2.0

SYNOPSIS
PxMbx_t PxMbxRelease (PxMbx_t Mbx);
ARGUMENTS
Mbx

Mailbox object to be released

RETURN VALUES
  • Invalid mailbox handle on success

  • Mailbox on failure

ERROR CODES

PXERR_MBX_ILLMBX

Mbx is not a valid mailbox object

PXERR_MBX_PRIVMBXDELETE

Mailbox delete failed: private mailbox

PXERR_MBX_LEFTMESSAGES

Mailbox delete failed: messages left in the mailbox

PXERR_MBX_TASKWAITS

Mailbox delete failed: task(s) waiting at the mailbox

PXERR_OPOOL_ILLOPOOL

The object pool is not valid

PXERR_GLOBAL_ILLEGAL_CORE

The requested object pool is not on the same core

PXERR_TASK_ILLTASK

The task is not a valid task object

DESCRIPTION

PxMbxRelease releases the mailbox handle Mbx by converting it into a generic object and releasing this object.

IMPLEMENTATION GUIDELINES
Before call
  • Mbx must be a valid PXROS-HR mailbox object created with a PxMbxRequest call (V). The validity of Mbx may also be checked by the PxMbxIsValid macro (F).

After call
  • PxMbxRelease returns the mailbox object to the object pool it has been taken from. On success PxMbxRelease returns the invalidated mailbox object. This may be checked with one of the following macros:

    • PxMbxIsValid() must be false.

    • PxMbxGet() must be _PXIllegalObjId.

    • PxMbxError() must be PXERR_NOERROR otherwise the returned error code has to be interpreted (C).

Best Practice
  • After PxMbxRelease, the given mailbox object Mbx is no longer valid and may never be used as mailbox object!

SEE ALSO
USAGE
#include "pxdef.h"

PxMbx_t Mbx = PxMbxRelease(Mbx);

if (PxMbxIdError(Mbx) == PXERR_NOERROR) {
    // Report error
}