SimpleProducerConsumer Sample
Description
This sample builds two applications:
- The consumer application opens a memory address that is shared between the eRTOS kernel and Windows. The program reads the shared memory address and then sets a globally named event to report that it has completed reading the data. The program will end when a TERMINATE_EVENT is signaled.
- The producer application creates and writes to a globally named shared memory address. The program writes the shared memory address and then sets a globally named event to report it has completed writing the data. The program will run for a set number of iterations and then set a TERMINATE_EVENT. Outside of the loop it will report on the performance of each exchange.
Source Files
| File | Description |
|---|---|
| SimpleIPCConsumer.c |
The main source file for Consumer. |
| SimpleIPCProducer.c | The main source file for Producer. |
| SimpleIPCConsumer.h |
The header file for Consumer. |
| SimpleIPCProducer.h | The header file for Producer. |
| ProducerConsumer.h | A header file that is shared between the two applications. |
Building the Sample
- Open a project file in the corresponding Visual Studio version you use for development.
- Build the project.
Running the SimpleProducerConsumer Sample
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 SimpleProducerConsumer.
Note: For more information on Run commands, see Run.
- If using pre-written Run commands, 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