msgRecv#
Synopsis#
#include <sys/msg.h>
int msgRecv(uint32_t port, msg_t *m, unsigned long int *rid);
Status#
Implemented
Conformance#
Phoenix-RTOS specific
Description#
This function should read a message from port and store its contents in msg_t
structure pointed by m. rid
parameter specifies receiving context and should be passed to msgRespond()
.
Upon calling msgRecv()
the receiving thread is suspended until one of the following occurs:
a new message is received
port is closed
an error occurs
signal is received
msgRecv()
does not finish the communication between sender and receiver and is only used to get contents of a
message. To properly finish the communication msgRespond()
shall be called with appropriate *rid
value to
respond to the message and end communication between processes. If no msgRespond()
is called the message sender
will wait indefinitely for a response.
This function is part of interprocess communication mechanisms in Phoenix-RTOS. For more information about messaging
process and msg_t
message structure please refer to Message Passing.
Return value#
If an error occurred during a function call an error value shall be returned. Otherwise, returns 0
.
Errors#
This function shall fall if:
-EINVAL
- port does not name an existing port, or port is closed-EINTR
- thread was woken up by signal during waiting for messages inmsgRecv()
-ENOMEM
- insufficient memory is available for allocating incoming message
Tests#
Untested
Known bugs#
None