Opens a semaphore for access control. When the semaphore is opened, it is initially signalled. Use a semaphore for controlling access to a restricted device, for example, to stop another Cicode task accessing a device while it is in use. You might require semaphores for some Cicode operations, because they can access a device that is critical. (Cicode is a multi-tasking system.)
Note: This function is process-based, not computer-based, and so will only prevent access to a critical section within a single process. This function only works between Cicode tasks within the same process.
The name of the semaphore.
The mode of the open:
0 - Open existing semaphore.
1 - Create new semaphore.
2 - Attempts to open an existing semaphore. If the semaphore does not exist, it will create it.
The semaphore handle, or -1 if the semaphore was not opened successfully. The semaphore handle identifies the table where all data on the associated semaphore is stored.
SemClose, SemSignal, SemWait