POSIX semaphores are much lighter weight than are System V semaphores. A POSIX semaphore structure defines a single semaphore, not an array of up to 25 semaphores.
The POSIX semaphore interfaces are shown below.
Table 5–3 POSIX Semaphore Interfaces
Connects to, and optionally creates, a named semaphore |
|
Initializes a semaphore structure (internal to the calling program, so not a named semaphore) |
|
Ends the connection to an open semaphore |
|
Ends the connection to an open semaphore and causes the semaphore to be removed when the last process closes it |
|
Initializes a semaphore structure (internal to the calling program, so not a named semaphore) |
|
Copies the value of the semaphore into the specified integer |
|
Blocks while the semaphore is held by other processes or returns an error if the semaphore is held by another process |
|
Increments the count of the semaphore |