php8.5
Home/ Manual/ sync / syncreaderwriter/ SyncReaderWriter::readlock

SyncReaderWriter::readlock

PHP function Edit on GitHub ✎

(PECL sync >= 1.0.0)

Waits for a read lock

Description

SyncReaderWriter::readlock(int $wait = -1): bool

Obtains a read lock on a SyncReaderWriter object.

Parameters

wait

The number of milliseconds to wait for a lock. A value of -1 is infinite.

Return Values

Success

Examples

SyncReaderWriter::readlock() example

php
<?php
$readwrite = new SyncReaderWriter("FileCacheLock");
$readwrite->readlock();
/* ... */
$readwrite->readunlock();
?>

See Also

  • SyncReaderWriter::readunlock

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