1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-03 10:07:49 +01:00
parallel/src/Sync/MutexInterface.php

21 lines
540 B
PHP
Raw Normal View History

2015-08-02 03:15:03 +02:00
<?php
namespace Icicle\Concurrent\Sync;
/**
* A simple mutex that provides asynchronous, atomic locking and unlocking across
2015-08-02 03:15:03 +02:00
* 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.
2015-08-02 03:15:03 +02:00
*/
interface MutexInterface
{
/**
* Acquires a lock on the mutex.
*
* @return \Generator Resolves with a lock object when the acquire is successful.
2015-08-02 03:15:03 +02:00
*/
public function acquire();
2015-08-02 03:15:03 +02:00
}