Updated readme
This commit is contained in:
parent
4652e464b9
commit
c9c4a8aa78
23
README.md
23
README.md
@ -85,8 +85,31 @@ this identifier, and thus point to another segment, just clone it.
|
|||||||
|
|
||||||
### Semaphores
|
### Semaphores
|
||||||
|
|
||||||
|
Semaphores are created with a key and a max count.
|
||||||
|
|
||||||
|
$key = new FileKey(__FILE__);
|
||||||
|
$sem = new Semaphore($key, 2);
|
||||||
|
|
||||||
|
$sem->allocate(); // -> true
|
||||||
|
$sem->allocate(); // -> true
|
||||||
|
$sem->allocate(); // -> false
|
||||||
|
$sem->release();
|
||||||
|
|
||||||
|
$mutex->destroy();
|
||||||
|
|
||||||
### Mutexes
|
### Mutexes
|
||||||
|
|
||||||
|
A mutex is a semaphore with a max count of 1.
|
||||||
|
|
||||||
|
$key = new FileKey(__FILE__);
|
||||||
|
$mutex = new Mutex($key);
|
||||||
|
|
||||||
|
$mutex->allocate(); // -> true
|
||||||
|
$mutex->allocate(); // -> false
|
||||||
|
$mutex->release();
|
||||||
|
|
||||||
|
$mutex->destroy();
|
||||||
|
|
||||||
### Message Queues
|
### Message Queues
|
||||||
|
|
||||||
$key = new FileKey(__FILE__);
|
$key = new FileKey(__FILE__);
|
||||||
|
Loading…
Reference in New Issue
Block a user