|proc||-||The ID of the process that is awaiting data via a semaphore.|
|data||-||The data to be sent to the other process via a semaphore.|
This routine sends data from one process to another via a semaphore. The process that will receive the data must be expecting input via its semaphore. The semaphore mechanism provides a means for synchronizing multiple processes. Semaphores are accessed via ports. The semaphore associated with a particular process is equal to the base address for semaphore ports plus the process ID.
(TEA file stored in file slot 0)
(TEA file stored in file slot 1)
void main(char callingProcID)
The first program (0) runs the second program (1) as process 3. The two processes take turns passing a value back and forth. The value is increased by 100 on each round-trip. Both processes terminate and the calling process returns the final value of 300.