ABSTRACT

This chapter explains inter-thread communication. In bare-metal programming, global variables are used for communication between functions. A mailbox service is a typical inter-thread communication method in real-time operating systems. The mailbox of the Real Time-Thread (RT-Thread) operating system is used for inter-thread communication, which is characterized by low overhead and high efficiency. The sending process of the non-blocking mode mails can be safely used in interrupt service routines. It is an effective way for the thread, the interrupt service, and the timer to send a mail to the thread. In RT-Thread, the mailbox control block is a data structure used by the operating system to manage mailboxes, represented by the structure structrt_mailbox. Initializing a mailbox is similar to creating a mailbox, except that the mailbox initialized is for static mailbox objects. A mailbox is a simple inter-thread messaging method, which is characterized by low overhead and high efficiency.