3 Star 21 Fork 3

阿宝 / threadtask

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
cmd.php 632 Bytes
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env php
<?php
$running = true;
function signal($sig) {
global $running;
echo THREAD_TASK_NAME . ' ';
echo 'cmd sig = ', $sig, PHP_EOL;
$running = false;
}
pcntl_async_signals(true);
pcntl_signal(SIGTERM, 'signal', false);
pcntl_signal(SIGINT, 'signal', false);
var_dump($_SERVER['argv']);
$t = microtime(true);
$running and usleep(mt_rand(10000, 1000000));
echo THREAD_TASK_NAME . ' ';
echo 'runtime ', (int)((microtime(true)-$t)*1000000) / 1000, 'ms', PHP_EOL;
if(isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] === 'return') {
share_var_set($_SERVER['argv'][2], (int)((microtime(true)-$t)*1000000)/1000);
}
C
1
https://gitee.com/talent518/threadtask.git
git@gitee.com:talent518/threadtask.git
talent518
threadtask
threadtask
main

搜索帮助