php8.5
Home/ Manual/ sync / syncsemaphore/ SyncSemaphore::unlock

SyncSemaphore::unlock

PHP function Edit on GitHub ✎

(PECL sync >= 1.0.0)

Increases the count of the semaphore

Description

SyncSemaphore::unlock([int $prevcount]): bool

Increases the count of a SyncSemaphore object.

Parameters

prevcount

Returns the previous count of the semaphore.

Return Values

Success

Examples

SyncSemaphore::unlock() example

php
<?php
$semaphore = new SyncSemaphore("LimitedResource_2clients", 2);

if (!$semaphore->lock(3000))
{
    echo "Unable to lock semaphore.";

    exit();
}

/* ... */

$semaphore->unlock();
?>

See Also

  • SyncSemaphore::lock

Source: reference/sync/syncsemaphore/unlock.xml · from the official PHP manual (php/doc-en)