1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-02 17:52:14 +01:00
parallel/lib/Sync/Mutex.php
2016-12-29 19:16:04 -06:00

26 lines
637 B
PHP

<?php
namespace Amp\Parallel\Sync;
use Interop\Async\Promise;
/**
* A non-blocking synchronization primitive that can be used for mutual exclusion across contexts.
*
* Objects that implement this interface should guarantee that all operations
* are atomic. Implementations do not have to guarantee that acquiring a lock
* is first-come, first serve.
*/
interface Mutex
{
/**
* @coroutine
*
* Acquires a lock on the mutex.
*
* @return \Interop\Async\Promise<\Amp\Parallel\Sync\Lock> Resolves with a lock object when the acquire is
* successful.
*/
public function acquire(): Promise;
}