/**
 * @author bigbigant
 * 
 *    进程结构
 *    master
 *    |-worker
 *    |-worker
 *    |_worker
 *
 */
require __DIR__ . '/bootstrap.inc.php';
use Comos\Qpm\Process\Process;
echo "The simple master-workers demo is running now.\nCtrl+c to quit.\n";
// Start Daemon
master(5);
/**
 * start a worker(child) Process.
 */
function startWorker()
{
    Process::fork('worker');
}
/**
 * master.
 * 
 * to start and mantaince child Processes.
 * 
 * @param integer $maxChildren
 */
function master($maxChildren)
Exemple #2
0
/**
 * Documentation inline tags
 *
 * The function works only with {@link master()}
 */
function slave()
{
    master();
}