   'phpDocumentor\Descriptor\FileDescriptor * hash 9bfc34df07bcfdd87f6c6b028a7f4924 * pathCoroutine/CTask.php	 * sourceI<?php
/**
 * Task协程
 *
 * 由worker进程投递到tasker进程的任务
 *
 * @author camera360_server@camera360.com
 * @copyright Chengdu pinguo Technology Co.,Ltd.
 */

namespace PG\MSF\Coroutine;

/**
 * Class CTask
 * @package PG\MSF\Coroutine
 */
class CTask extends Base
{
    /**
     * @var int 任务ID
     */
    public $id;

    /**
     * @var array 任务执行参数
     */
    public $taskProxyData;

    /**
     * 初始化Task协程对象
     *
     * @param array $taskProxyData 待执行的Task信息
     * @param int $id Task ID
     * @param int $timeout 超时时间，单位秒
     */
    public function __construct($taskProxyData, $id, $timeout)
    {
        parent::__construct($timeout);
        $this->taskProxyData = $taskProxyData;
        $this->id            = $id;
        $profileName         = $taskProxyData['message']['task_name'] . '::' . $taskProxyData['message']['task_fuc_name'];
        $this->requestId     = $this->getContext()->getLogId();

        $this->getContext()->getLog()->profileStart($profileName);
        getInstance()->scheduler->IOCallBack[$this->requestId][] = $this;
        $keys = array_keys(getInstance()->scheduler->IOCallBack[$this->requestId]);
        $this->ioBackKey = array_pop($keys);

        $this->send(function ($serv, $taskId, $data) use ($profileName) {
            if ($this->isBreak) {
                return;
            }

            if (empty(getInstance()->scheduler->taskMap[$this->requestId])) {
                return;
            }

            $this->getContext()->getLog()->profileEnd($profileName);
            $this->result = $data;
            $this->ioBack = true;
            $this->nextRun();
        });
    }

    /**
     * 投递异步任务给Tasker进程
     *
     * @param callable $callback 任务完成后的回调函数
     * @return $this
     */
    public function send($callback)
    {
        getInstance()->server->task($this->taskProxyData, $this->id, $callback);
        return $this;
    }

    /**
     * 销毁
     */
    public function destroy()
    {
        parent::destroy();
    }
}
 * namespaceAliases#phpDocumentor\Descriptor\Collection * items  * includes	  * constants	  * functions	 
 * classes	\PG\MSF\Coroutine\CTask(phpDocumentor\Descriptor\ClassDescriptor	 * parent\PG\MSF\Coroutine\Base * implements	  * abstract * final	  * properties	id+phpDocumentor\Descriptor\PropertyDescriptor" * types 
 * default 	 * static * visibilitypublic * fqsen\PG\MSF\Coroutine\CTask::id * name * namespace 
 * package
 * summary * description * fileDescriptor  * line * tags	var	 *phpDocumentor\Descriptor\Tag\VarDescriptor * variableName	 /phpDocumentor\Descriptor\Type\IntegerDescriptor '#任务ID	 * errors	 ,	  * inheritedElement taskProxyData"  &\PG\MSF\Coroutine\CTask::taskProxyData.  !"#$ %&	'	 ()	 3phpDocumentor\Descriptor\Type\UnknownTypeDescriptorarray'#任务执行参数,	 ,	 - 
 * methods	__construct)phpDocumentor\Descriptor\MethodDescriptor" * arguments	$taskProxyData+phpDocumentor\Descriptor\ArgumentDescriptor	 * method".	 01  * byReference * isVariadic7  !"#待执行的Task信息$ % &	 ,	 - $id89".	 *  :;=  !"#Task ID$ % &	 ,	 - $timeout89".	 *  :;?  !"#超时时间，单位秒$ % &	 ,	 - &\PG\MSF\Coroutine\CTask::__construct()4  !"初始化Task协程对象#$ %$&	param	 ,phpDocumentor\Descriptor\Tag\ParamDescriptor)7"2C#<,	 D)=":C#>,	 D)?"BC#@,	 return	 ,	 - send5"6		$callback89"Z	 0callable :;G  !"#任务完成后的回调函数$ % &	 ,	 - \PG\MSF\Coroutine\CTask::send()F  !"!投递异步任务给Tasker进程#$ %G&	C	 D)G"^C#I,	 E	 -phpDocumentor\Descriptor\Tag\ReturnDescriptor	 0$thisE#,	 ,	 - destroy5"6	 "\PG\MSF\Coroutine\CTask::destroy()N  !"销毁#$ %P&	E	 C	 ,	 -  * usedTraits	 CTask \PG\MSF\Coroutine!PG\MSF\Coroutine"Class CTask#$" %&	package	 &phpDocumentor\Descriptor\TagDescriptorV#T,	 
subpackage	 ,	 -  * interfaces	 	 * traits	 
 * markers	 	CTask.php  !Default"
Task协程#-由worker进程投递到tasker进程的任务$ % &	author	 -phpDocumentor\Descriptor\Tag\AuthorDescriptor`#camera360_server@camera360.com,	 	copyright	 Wc#"Chengdu pinguo Technology Co.,Ltd.,	 V	 WV#],	 X	 ,	 - 