PHP code example of switon / sync
1. Go to this page and download the library: Download switon/sync library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
switon / sync example snippets
use Switon\Sync\Channel;
use Switon\Sync\WaitGroup;
$channel = new Channel(10);
$channel->push('task-1');
$task = $channel->pop(); // 'task-1'
$wg = WaitGroup::of(2);
// task A
$wg->done();
// task B
$wg->done();
$wg->wait();