Updated readme
This commit is contained in:
		
							
								
								
									
										23
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								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__);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user