Message Queues
|
msgCreate ( ) |
Name: |
msgCreate ( ) - create a message queue |
Synopsis: |
MSG_HANDLE msgCreate
(
u32 u32MessageCount, /* max number of messages */
u32 u32SizeOfMessage /* size of each message */
)
|
Description: |
Creates a message queue which can contain a maximum of u32MessageCount
messages that are each u32SizeOfMessage bytes long. |
Include: |
msg.h |
Returns: |
The MSG_HANDLE of the newly created queue. Note that this
function will not return if the message queue cannot be created, instead
the system will halt (during development) or reboot (if in the field)
so there are no illegal values that can be returned. |
See Also: |
msgDestroy, msgWrite,
msgRead |
|
msgDestroy ( ) |
Name: |
msgDestroy ( ) - destroys a message queue |
Synopsis: |
void msgDestroy
(
MSG_HANDLE msgToDestroy /* message queue to destroy */
)
|
Description: |
Deletes and frees the associated memory of a message queue. |
Include: |
msg.h |
Returns: |
nothing |
See Also: |
msgCreate |
|
msgWrite ( ) |
Name: |
msgWrite ( ) - sends a message to a message queue |
Synopsis: |
STATUS msgWrite
(
MSG_HANDLE msgToWrite, /* queue to send message to */
void * vPtr, /* data to send to queue */
u32 u32MillisecondsToWait, /* timeout in ms */
MSG_PRIORITY msgPriority /* priority of message */
)
|
Description: |
Writes a message to a message queue. If the message queue is full,
it will block for u32MillisecondsToWait milliseconds. The value
NO_WAIT may be used for u32Milliseconds if a non blocking
write is needed and WAIT_FOREVER can be used if there is no
timeout. The parameter msgPriority may either be set to MSG_NORMAL
to place it at the end of the list or MSG_URGENT to place the
message at the beginning of the list.
Note that the vPtr parameter must point to a block of data
that is the same exact size of the parameter u32SizeOfMessage
in the function msgCreate.
|
Include: |
msg.h |
Returns: |
MSG_SUCCESS if a message was written or MSG_TIMEOUT
if u32MillisecondsToWait milliseconds elapsed before a space
to write the message became available in the queue. Note that MSG_TIMEOUT
can never be returned if u32MillisecondsToWait was set to WAIT_FOREVER
|
See Also: |
msgCreate, msgRead
|
|
msgRead ( ) |
Name: |
msgRead ( ) - retrieves a message from a message queue |
Synopsis: |
STATUS msgRead
(
MSG_HANDLE msgToRead, /* queue to read from */
void * vPtr, /* location to place message in */
u32 u32MillisecondsToWait /* timeout in ms */
)
|
Description: |
Reads a message from a message queue. If the message queue is empty,
it will block for u32MillisecondsToWait milliseconds. The value
NO_WAIT may be used for u32Milliseconds if a non blocking
read is needed and WAIT_FOREVER can be used if there is no
timeout.
Note that the vPtr parameter must point to a block of memory
that is the same exact size of the parameter u32SizeOfMessage
in the function msgCreate.
|
Include: |
msg.h |
Returns: |
MSG_SUCCESS if a message was read or MSG_TIMEOUT if
u32MillisecondsToWait milliseconds elapsed before a message
became available in the queue. Note that MSG_TIMEOUT can never
be returned if u32MillisecondsToWait was set to WAIT_FOREVER
|
See Also: |
msgCreate, msgWrite
|
|