sem_acquire

bool sem_acquire(int id) 

Acquires the semaphore identified by id.

Returns:

TRUE on success; FALSE on failure

Description:

sem_acquire() attempts to acquire the semaphore identified by id , and blocks until it can do so. Remember that a semaphore can be simultaneously acquired only as many times as specified in the max_acquire parameter to sem_get(); if this limit has been reached, sem_acquire blocks until the semaphore is released. id must be a valid semaphore identifier as returned by sem_get().

Version:

PHP 3 since 3.0.6, PHP 4

See also:

sem_get() 
sem_release() 

Example:

Simple multiple-script lock blocking
 /* To test this script, create two browser windows and load the * page containing this script in each of them simultaneously. ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.