|
Semaphores <sema.h> |
Top Previous Next |
|
This group of functions allows a Diamond program to create and manipulate semaphores, which can be used to synchronize the activity of several concurrently executing threads in a task.
The header file sema.h declares a type SEMA, which is used by these functions. Unlike in some operating systems, Diamond semaphores are not specially created by the kernel; they are ordinary variables (structures) that you can create anywhere in your program just like other variables.
In this version of Diamond, threads are placed in a queue of waiting processes, so that the first thread to start waiting on a semaphore is the first to be resumed.
|