PxMsgAwaitRel_EvWait()
Waits until a message is released or one of the given events is signaled.
- APPLIES TO
-
1.0.0
- SYNOPSIS
-
PxMsgEvent_t PxMsgAwaitRel_EvWait (PxMsg_t Msg, PxEvents_t events); - ARGUMENTS
|
|
|
- RETURN VALUES
-
-
Event that made the function return
-
- ERROR CODES
-
PXERR_MSG_ILLMSGThe passed message handle is invalid
PXERR_EVENT_ZEROthe given event mask is zero
PXERR_MSG_ILLOWNERThe calling task is not the owner of the message
PXERR_MSG_NOT_IMPLEMENTEDThe message has not been set to wait for its release
PXERR_MSG_ABORTEDThe service was aborted by an event while waiting for the message release
- DESCRIPTION
-
The
PxMsgAwaitRel_EvWaitwaits for the messageMsgto be released or event from events to be signaled. The messageMsgmust be created byPxMsgEnvelopor set toAwaitRelease. The calling task must be the owner of the message whose release is being awaited. The owner is always the task that created the message.
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
Msgmust be a valid message object, requested viaPxMsgRequest…orPxMsgEnvelop…or received by aPxMsgReceive…call (V). This id may be checked with one of the following macros:-
PxMsgIdIsValid()must be true. -
PxMsgIdGet()must not be_PXIllegalObjId. -
PxMsgIdError()must bePXERR_NOERRORotherwise the returned error code has to be interpreted (C).
-
-
The parameter
eventscontains a bitmask of events awaited and should not be zero. Typically the event mask is a constant (V). -
The calling task must be the message’s creator (V), and - if the message is created with
PxMsgRequest…- the message must be prepared by callingPxMsgSetToAwaitRel(V).
-
- After call
-
-
The returned value is a structure of type
PxMsgEvent_t. The received events are stored in theeventspart, the message id is given in themsgpart of the structure. This id may also be checked with the appropriate macros. If the message id is valid, the message may be released byPxMsgRelease.
-
- Best Practice
-
-
PxMsgAwaitRel_EvWaitmay block, if the message is never released and no instance (task or handler) sends an event. If blocking calls are prohibited,PxMsgAwaitRel_NoWaitshould be used instead.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" #define MY_EVENT_MASK 0x1l PxMsgEvent_t msgEvHnd = PxMsgAwaitRel_EvWait(Msg, MY_EVENT_MASK) if (msgEvHnd.events & MY_EVENT_MASK) { // Handle events } else if (PxMsgIdIsValid(msgEvHnd.msg) && PxMsgIdError(msgEvHnd.msg) == PXERR_NOERROR) { // Handle message } else { // Handle error }