sem_get

(PHP 3>= 3.0.6, PHP 4 )

sem_get -- Get a semaphore id

Description

int sem_get (int key [, int max_acquire [, int perm]])

Returns: A positive semaphore identifier on success, or false on error.

Sem_get() returns an id that can be used to access the System V semaphore with the given key. The semaphore is created if necessary using the permission bits specified in perm (defaults to 0666). The number of processes that can acquire the semaphore simultaneously is set to max_acquire (defaults to 1). Actually this value is set only if the process finds it is the only process currently attached to the semaphore.

A second call to sem_get() for the same key will return a different semaphore identifier, but both identifiers access the same underlying semaphore.

See also: sem_acquire() and sem_release().

Note: This function does not work on Windows systems