9.11 Example of Tasking and Synchronization

Examples

The following example
defines a buffer protected object to smooth variations between the speed
of output of a producing task and the speed of input of some consuming
task. For instance, the producing task might have the following structure:

The buffer object contains an internal array of person
names managed in a round-robin fashion. The array has two indices, an
In_Index denoting the index for the next input person name and an Out_Index
denoting the index for the next output person name.

The Buffer is defined as an extension of the Synchronized_Queue
interface (see 3.9.4), and as such promises
to implement the abstraction defined by that interface. By doing so,
the Buffer can be passed to the Transfer class-wide operation defined
for objects of a type covered by Queue'Class.