Updated readme

This commit is contained in:
Chris 2018-04-15 20:52:49 +02:00
parent 4652e464b9
commit c9c4a8aa78

View File

@ -85,8 +85,31 @@ this identifier, and thus point to another segment, just clone it.
### 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
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
$key = new FileKey(__FILE__);