當前位置: 首頁>>代碼示例>>PHP>>正文


PHP swoole_process::name方法代碼示例

本文整理匯總了PHP中swoole_process::name方法的典型用法代碼示例。如果您正苦於以下問題:PHP swoole_process::name方法的具體用法?PHP swoole_process::name怎麽用?PHP swoole_process::name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在swoole_process的用法示例。


在下文中一共展示了swoole_process::name方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: callback_process_function

function callback_process_function(swoole_process $worker)
{
    set_time_limit(300);
    $task = json_decode($worker->read(), true);
    $worker->name('crontab.php worker=' . $task['uniqid']);
    $Handle = new TimingCall_Handle($task);
    $Handle->upNextExecuteTime();
    $Handle->refreshStatistics();
    $Handle->Execute();
    $worker->exit(0);
}
開發者ID:imdaqian,項目名稱:Hi-Timed,代碼行數:11,代碼來源:cmd.php

示例2: child_async

function child_async(swoole_process $worker)
{
    //echo "Worker: start. PID=".$worker->pid."\n";
    //recv data from master
    $GLOBALS['worker'] = $worker;
    global $argv;
    $worker->name("{$argv[0]}: worker");
    swoole_process::signal(SIGTERM, function ($signal_num) use($worker) {
        echo "signal call = {$signal_num}, #{$worker->pid}\n";
    });
    swoole_event_add($worker->pipe, function ($pipe) use($worker) {
        $recv = $worker->read();
        echo "From Master: {$recv}\n";
        $worker->write("hello master\n");
    });
}
開發者ID:stonegithubs,項目名稱:swoole-game,代碼行數:16,代碼來源:server.php

示例3: function

 function child_async(swoole_process $worker)
 {
     //echo "Worker: start. PID=".$worker->pid."\n";
     global $argv;
     $worker->name("{$argv[0]}: worker #" . $worker->id . "/" . $this->worker_num);
     swoole_process::signal(SIGTERM, function ($signal_num) use($worker) {
         echo "signal call = {$signal_num}, #{$worker->pid}\n";
     });
     switch ($this->status) {
         case 'import':
             echo " worker #" . $worker->id . "/" . $this->worker_num . " enter status: " . $this->status . PHP_EOL;
             $this->import_data($worker);
             break;
         case '1-dim':
             echo " worker #" . $worker->id . "/" . $this->worker_num . " enter status: " . $this->status . PHP_EOL;
             $this->generate_1dim_rank($worker);
             break;
         case '2-dim':
             echo " worker #" . $worker->id . "/" . $this->worker_num . " enter status: " . $this->status . PHP_EOL;
             $this->generate_2dim_rank($worker);
             break;
         case '3-dim':
             echo " worker #" . $worker->id . "/" . $this->worker_num . " enter status: " . $this->status . PHP_EOL;
             $this->generate_3dim_rank($worker);
             break;
         default:
             break;
     }
     $worker->exit(0);
 }
開發者ID:shenxinyu,項目名稱:redis_rank,代碼行數:30,代碼來源:paralle_rank.php


注:本文中的swoole_process::name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。