Simple Data Exchange Sample

This sample demonstrates basic interprocess communication (IPC) using wRTOS real-time API objects. Specifically, it shows how multiple processes can synchronize and share data using a named event and shared memory. When the program is run for the first time, it attempts to open a named event. If the event does not exist, the program creates the event, writes a string into shared memory, and waits for a second process to signal the event. The second time the program is run, it finds the existing event and shared memory, reads the string, signals the event to notify the first instance, and exits. The first process, once signaled, also exits.

Source Files

File Description
SimpleDataExchange.h The header file.

SimpleDataExchange.c

The main source code for this sample.

Building the Sample

Build SimpleDataExchange.rtss or SimpleDataExchange.exe

Running the Sample

Run SimpleDataExchange.rtss and/or SimpleDataExchange.exe twice.

Expected Results

Unexpected Result

The second event fails to open or be created, causing the first to wait indefinitely for a signal.

Remarks

APIs Referenced

RTAPI

Windows-Supported