Mailbox Sample
Description
This sample creates an instance of a mailbox that is thread-safe. It spawns off instances of reader and writer threads which inherit the mailbox instance and begin reading and writing when it is available to do either. This will run for 1 minute, and then the program will shut down. The reader threads will output what it is reading and how often the thread has gone into the mailbox to read a message. Writer threads will put messages into the mailbox but are otherwise silent.
Source Files
| File | Description |
|---|---|
| Mailbox.cpp | The main source file, which contains the mailbox class and a small main function to demonstrate the mailbox in use. |
| Mailbox.h | Contains the mailbox class declaration and any required header files. |
Building the Sample
- Open a project file in the corresponding Visual Studio version you use for development.
- Build the project.
Running Mailbox
To run the sample:
- Boot the system in its Windows Boot Configuration.
- Navigate to
<InstallDrive>\MaxRT\eRTOS\. - Right-click AutoStart.bat and select Edit.
- Find or write the Run command(s) for Mailbox.
Note: For more information on Run commands, see Run.
- If using pre-written Run command(s), remove the comment characters (: :) to enable the command(s).
- Re-boot the system from a GRUB bootable USB drive or hard drive.
- Select the desired GRUB boot configuration. See GRUB Boot Configurations for more information.
- Upon system boot, the sample(s) will run automatically after the eRTOS Kernel startup.
- Sample output will be displayed on the screen when the program ends.
- Re-boot the system in its Windows Boot Configuration.
- Navigate to
<InstallDrive>\MaxRT\eRTOS\. - Open the RtLogFile.txt log file to view sample output.
APIs Referenced