1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-03 18:17:52 +01:00
parallel/lib/Sync/Mutex.php
Aaron Piotrowski da84a772cf Port to Amp
2016-08-18 11:04:48 -05:00

26 lines
647 B
PHP

<?php
namespace Amp\Concurrent\Sync;
use Interop\Async\Awaitable;
/**
* 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\Awaitable<\Amp\Concurrent\Sync\Lock> Resolves with a lock object when the acquire is
* successful.
*/
public function acquire(): Awaitable;
}