... continued

Continues the discussion on the Monitor class.

Ping Pong Example

We can rewrite our ping-pong example without busy waiting using Monitor. The two threads Wait() and Pulse() to not busy wait. The code is self-explanatory and appears below, the widget runs for ten seconds and then timees out.