A mailbox is a mechanism to exchange messages between processes. Data can be sent to a mailbox by one process and retrieved by another. Conceptually, mailboxes behave like real mailboxes. When a letter is delivered and put into the mailbox, you can retrieve the letter (and any data stored within). However, if the letter has not been delivered when you check the mailbox, you must choose whether to wait for the letter or retrieve the letter on subsequent trips to the mailbox.Similarly, OpenVeraâ~@~Ys mailboxes allow you to transfer and retrieve data in a very controlled manner.
To allocate a mailbox, you must use the alloc() system function.
Syntax : function integer alloc(MAILBOX, integer mailbox_id, integer mailbox_count);
mailbox_id is the ID number of the particular mailbox being created. It must be an integer value. You should generally use 0. When you use 0, Vera automatically generates a mailbox ID.
mailbox_count specifies how many mailboxes you want to create. It must be an integer value.
The mailbox_put() system task sends data to the mailbox.
The mailbox_get() system function returns data stored in a mailbox.