Xinu's mailbox subsystem allows threads to send and receive messages to each other.
More...
Xinu's mailbox subsystem allows threads to send and receive messages to each other.
syscall mailboxAlloc |
( |
uint |
count | ) |
|
Allocate a mailbox that allows up to the specified number of outstanding messages.
- Parameters
-
count | Maximum number of messages allowed for the mailbox. |
- Returns
- The index of the newly allocated mailbox, or ::SYSERR if all mailboxes are already in use or other resources could not be allocated.
syscall mailboxCount |
( |
mailbox |
box | ) |
|
Retrieve the number of outstanding messages in the specified mailbox.
- Parameters
-
box | The index of the mailbox for which to retrieve the number of outstanding messages. |
- Returns
- The number of messages in the mailbox, or ::SYSERR if
box
did not specify a valid allocated mailbox.
syscall mailboxFree |
( |
mailbox |
box | ) |
|
Free the specified mailbox.
- Parameters
-
box | The index of the mailbox to free. |
- Returns
- ::OK if the mailbox was successfully freed, or ::SYSERR if
box
did not specify a valid allocated mailbox.
syscall mailboxInit |
( |
void |
| ) |
|
Initialize mailbox structures.
- Returns
- ::OK if all mailboxes were initialized successfully, otherwise ::SYSERR.
syscall mailboxReceive |
( |
mailbox |
box | ) |
|
Receive a message from the specified mailbox.
- Parameters
-
box | The index of the mailbox to receive the message from. |
- Returns
- On success, returns the message that was dequeued; on failure (
box
did not specify an allocated mailbox, or the mailbox was freed while waiting for a message) returns ::SYSERR. Note that it may be impossible to disambiguate ::SYSERR from a successful return value.
syscall mailboxSend |
( |
mailbox |
box, |
|
|
int |
mailmsg |
|
) |
| |
Send a message to the specified mailbox.
- Parameters
-
box | The index of the mailbox to send the message to. |
mailmsg | The message to send. |
- Returns
- ::OK if the message was successfully enqueued, otherwise ::SYSERR. ::SYSERR is returned only if
box
did not specify a valid allocated mailbox or if the mailbox was freed while waiting for room in the queue.