Warning: This program contains a subtle error which could lead to deadlock. It is deliberately left in as an exercise in analyzing the subtleties of concurrent code.
This program can be compiled using Ada95 (it has only been tested on Linux systems running the GNAT Ada compiler).