|
Description
This sample creates an instance of a mailbox which 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 itself down. The reader threads will output what it is reading and how many times the particular thread has gone into the mailbox to read a message. Writer threads will put messages into the mailbox but are otherwise silent.
Source Files
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 filesSetting up the Mailbox test
Build MailBox.rtss
or MailBox.exe
Running Mailbox
Run with no arguments
APIs Referenced
RTAPI |