|
|
Create the semaphore named inName with initial count inInitialCount and maximum count inMaximumCount. If the named semaphore already exists, that semaphore is used. If the semaphore could not be created or opened the following runtime error is generated: "Semaphore: failed to create.".
- Exceptions:
-
| Semaphore: failed to create. | if the semaphore could not be created or opened this runtime error message is generated. |
- Parameters:
-
| inName | a null-terminated string specifying the name of the semaphore object. The name is limited to MAX_PATH characters, and can contain any character except the backslash path-separator character (\). Name comparison is case sensitive. If lpName matches the name of an existing named semaphore object, this function requests SEMAPHORE_ALL_ACCESS access to the existing object. In this case, the lInitialCount and lMaximumCount parameters are ignored because they have already been set by the creating process. If the lpSemaphoreAttributes parameter is not NULL, it determines whether the handle can be inherited, but its security-descriptor member is ignored.
If lpName is NULL, the semaphore object is created without a name. If lpName matches the name of an existing event, mutex, or file- mapping object, the function fails and the GetLastError function returns ERROR_INVALID_HANDLE. This occurs because event, mutex, semaphore, and file-mapping objects share the same name space. |
| inInitialCount | specifies an initial count for the semaphore object. This value must be greater than or equal to zero and less than or equal to lMaximumCount. The state of a semaphore is signaled when its count is greater than zero and nonsignaled when it is zero. The count is decreased by one whenever a wait function releases a thread that was waiting for the semaphore. The count is increased by a specified amount by calling the ReleaseSemaphore function. |
| inMaximumCount | specifies the maximum count for the semaphore object. This value must be greater than zero. |
|