Initial commit
This commit is contained in:
		
							
								
								
									
										15
									
								
								examples/timers.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								examples/timers.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
require_once __DIR__."/../vendor/autoload.php";
 | 
			
		||||
 | 
			
		||||
use NoccyLabs\Ipc\Interop\Async\Timer;
 | 
			
		||||
 | 
			
		||||
$timer1 = new Timer(function () { echo "Hello "; });
 | 
			
		||||
$timer2 = new Timer(function () { echo "World! "; });
 | 
			
		||||
 | 
			
		||||
for ($n = 0; $n < 1000; $n++) {
 | 
			
		||||
  if ($n == 500) {
 | 
			
		||||
    unset($timer2);
 | 
			
		||||
  }
 | 
			
		||||
  usleep(10000);
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user