Files | |
file | mbx.c |
Mailbox functions. | |
Functions | |
int | _rt_mbx_evdrp (MBX *mbx, void *msg, int msg_size, int space) |
Receives bytes as many as possible leaving the message available for another receive. | |
int | rt_typed_mbx_init (MBX *mbx, int size, int type) |
Initializes a fully typed mailbox queueing tasks according to the specified type. | |
int | rt_mbx_init (MBX *mbx, int size) |
Initializes a mailbox. | |
int | rt_mbx_delete (MBX *mbx) |
Deletes a mailbox. | |
int | _rt_mbx_send (MBX *mbx, void *msg, int msg_size, int space) |
Sends a message unconditionally. | |
int | _rt_mbx_send_wp (MBX *mbx, void *msg, int msg_size, int space) |
Sends as many bytes as possible without blocking the calling task. | |
int | _rt_mbx_send_if (MBX *mbx, void *msg, int msg_size, int space) |
Sends a message, only if the whole message can be passed without blocking the calling task. | |
int | _rt_mbx_send_until (MBX *mbx, void *msg, int msg_size, RTIME time, int space) |
Sends a message with absolute timeout. | |
int | _rt_mbx_send_timed (MBX *mbx, void *msg, int msg_size, RTIME delay, int space) |
Sends a message with relative timeout. | |
int | _rt_mbx_receive (MBX *mbx, void *msg, int msg_size, int space) |
Receives a message unconditionally. | |
int | _rt_mbx_receive_wp (MBX *mbx, void *msg, int msg_size, int space) |
Receives bytes as many as possible, without blocking the calling task. | |
int | _rt_mbx_receive_if (MBX *mbx, void *msg, int msg_size, int space) |
Receives a message only if the whole message can be passed without blocking the calling task. | |
int | _rt_mbx_receive_until (MBX *mbx, void *msg, int msg_size, RTIME time, int space) |
Receives a message with absolute timeout. | |
int | _rt_mbx_receive_timed (MBX *mbx, void *msg, int msg_size, RTIME delay, int space) |
Receives a message with relative timeout. | |
int | _rt_mbx_ovrwr_send (MBX *mbx, void *msg, int msg_size, int space) |
Sends a message overwriting what already in the buffer if there is no place for the message. | |
MBX * | _rt_typed_named_mbx_init (unsigned long mbx_name, int size, int qtype) |
Initializes a specifically typed (fifo queued, priority queued or resource queued) mailbox identified by a name. | |
int | rt_named_mbx_delete (MBX *mbx) |
Deletes a named mailbox. |
|
Receives bytes as many as possible leaving the message available for another receive. rt_mbx_evdrp receives at most msg_size of bytes of message from the mailbox mbx and then returns immediately. Does what rt_mbx_receive_wp does while keeping the message in the mailbox buffer. Useful if one needs to just preview the mailbox content, without actually receiving it.
|
|
Sends a message overwriting what already in the buffer if there is no place for the message. rt_mbx_ovrwr_send sends the message msg of msg_size bytes to the mailbox mbx overwriting what already in the mailbox buffer if there is no place for the message. Useful for logging purposes. It returns immediately and the caller is never blocked.
|
|
Receives a message unconditionally. rt_mbx_receive receives a message of msg_size bytes from the mailbox mbx. The caller will be blocked until all bytes of the message arrive or an error occurs.
|
|
Receives a message only if the whole message can be passed without blocking the calling task. rt_mbx_receive_if receives a message from the mailbox mbx if the whole message of msg_size bytes is available immediately.
|
|
Receives a message with relative timeout. rt_mbx_receive_timed receives a message of msg_size bytes from the mailbox mbx. The caller will be blocked until all bytes of the message arrive, timeout expires or an error occurs.
|
|
Receives a message with absolute timeout. rt_mbx_receive_until receives a message of msg_size bytes from the mailbox mbx. The caller will be blocked until all bytes of the message arrive, timeout expires or an error occurs.
|
|
Receives bytes as many as possible, without blocking the calling task. rt_mbx_receive_wp receives at most msg_size of bytes of message from the mailbox mbx then returns immediately.
|
|
Sends a message unconditionally. rt_mbx_send sends a message msg of msg_size bytes to the mailbox mbx. The caller will be blocked until the whole message is copied into the mailbox or an error occurs. Even if the message can be sent in a single shot, the sending task can be blocked if there is a task of higher priority waiting to receive from the mailbox.
|
|
Sends a message, only if the whole message can be passed without blocking the calling task. rt_mbx_send_if tries to atomically send the message msg of msg_size bytes to the mailbox mbx. It returns immediately and the caller is never blocked.
|
|
Sends a message with relative timeout. rt_mbx_send_timed send a message msg of msg_size bytes to the mailbox mbx. The caller will be blocked until all bytes of message is enqueued, timeout expires or an error occurs.
|
|
Sends a message with absolute timeout. rt_mbx_send_until sends a message msg of msg_size bytes to the mailbox mbx. The caller will be blocked until all bytes of message is enqueued, timeout expires or an error occurs.
|
|
Sends as many bytes as possible without blocking the calling task. rt_mbx_send_wp atomically sends as many bytes of message msg as possible to the mailbox mbx then returns immediately.
|
|
Initializes a specifically typed (fifo queued, priority queued or resource queued) mailbox identified by a name. _rt_typed_named_mbx_init initializes a mailbox of type qtype and size size identified by name. Named mailboxed are useful for use among different processes, kernel/user space and in distributed applications, see netrpc.
|
|
Deletes a mailbox. rt_mbx_delete removes a mailbox previously created with rt_mbx_init().
|
|
Initializes a mailbox. rt_mbx_init initializes a mailbox of size size. mbx must point to a user allocated MBX structure. Using mailboxes is a flexible method for inter task communications. Tasks are allowed to send arbitrarily sized messages by using any mailbox buffer size. There is even no need to use a buffer sized at least as the largest message you envisage, even if efficiency is likely to suffer from such a decision. However if you expect a message larger than the average message size very rarely you can use a smaller buffer without much loss of efficiency. In such a way you can set up your own mailbox usage protocol, e.g. using fix sized messages with a buffer that is an integer multiple of such a size guarantees maximum efficiency by having each message sent/received atomically to/from the mailbox. Multiple senders and receivers are allowed and each will get the service it requires in turn, according to its priority. Thus mailboxes provide a flexible mechanism to allow you to freely implement your own policy. rt_mbx_init is equivalent to rt_typed_mbx_init(mbx, size, PRIO_Q).
|
|
Deletes a named mailbox. rt_named_mbx_delete removes a mailbox previously created with _rt_typed_named_mbx_init().
|
|
Initializes a fully typed mailbox queueing tasks according to the specified type. rt_typed_mbx_init initializes a mailbox of size size. mbx must point to a user allocated MBX structure. Tasks are queued in FIFO order (FIFO_Q), priority order (PRIO_Q) or resource order (RES_Q).
|