diff --git a/README.md b/README.md index c34ac4d..d879bec 100644 --- a/README.md +++ b/README.md @@ -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__);