1 Star 0 Fork 3

曹海为 / threadtask

forked from 阿宝 / 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);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/cao-haiwei/threadtask.git
git@gitee.com:cao-haiwei/threadtask.git
cao-haiwei
threadtask
threadtask
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891