Simple PingPong Sample

This program spawns two threads. The threads signal each other repeatedly for a specified length of time. When time expires, the main thread signals the threads to complete and ends the program.

Source Files

File Description
PingPong.cpp The main source file that contains the Ping and Pong thread functions.
PingPong.h The header file containing declarations of thread functions.

Building the Sample

Build PingPong.rtss or PingPong.exe.

Running the Sample

Run with no arguments.

Expected Results

The program succeeds and displays alternating Ping! and Pong! messages on the screen. (If the program fails, it displays an error message.)

Created the ping thread...
Created the pong thread...
======================================
Ping!
Pong!
...
both threads finished closing the program

Unexpected Results

There should not be consecutive Ping! or Pong! messages.

Remarks

APIs Referenced

RTAPI