OpenSemaphore
Opens the specified semaphore or creates it if it does not exist
#include <\nlm\nit\nwsync.h> int OpenSemaphore ( char *semaphoreName, int initialValue, long *semaphoreHandle, WORD *openCount);
For cross-platform functionality, call NWOpenSemaphore.
The semaphoreValue is ignored unless this call creates the semaphore (because it did not already exist). The value can range from 1 to 127, indicating that only 1 to 127 processes can access the network resource at a time. A call to SignalSemaphore increments this value. A call to WaitOnSemaphore decrements this value.
The openCount indicates the number of processes holding the semaphore open. A call to OpenSemaphore increments this value. A call to CloseSemaphore decrements this value.
The value returned in the semaphoreHandle parameter is the semaphore handle. The application must pass this value in calls to all other semaphore functions.
The application must pass either the name of an existing semaphore or the name of the new semaphore in the semaphoreName parameter. A semaphore name is an ASCIIZ string from 1 to 127 bytes long.
If the specified semaphore does not exist, this function creates and initializes the semaphore to initialValue.
The openCount parameter indicates the number of processes using the semaphore.
CloseSemaphore, ExamineSemaphore, SignalSemaphore, WaitOnSemaphore