\PG\MSF\CoroutineBase

Class Base

Summary

Methods
Properties
Constants
__construct()
getResult()
throwTimeOutException()
isTimeout()
nextRun()
destroy()
__unsleep()
breakx()
setTimeout()
send()
$maxTimeout
$request
$result
$timeout
$requestTime
$responseTime
$ioBack
$ioBackKey
$isBreak
$requestId
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$maxTimeout

$maxTimeout : integer

Type

integer — 协程运行的最大超时时间

$request

$request : string

Type

string — 请求参数

$result

$result : mixed

Type

mixed — IO协程运行的结束

$timeout

$timeout : integer

Type

integer — 协程执行的超时时间精确到ms

$requestTime

$requestTime : float

Type

float — 协程执行请求开始时间

$responseTime

$responseTime : float

Type

float — 协程执行请求结束时间

$ioBack

$ioBack : boolean

Type

boolean — IO协程是否返回数据

$ioBackKey

$ioBackKey : integer|null

Type

integer|null — ioBack标识

$isBreak

$isBreak : boolean

Type

boolean — 是否发送异步请求后不需要执行回调

$requestId

$requestId : string|null

Type

string|null — 整个请求标识

Methods

__construct()

__construct(integer  $timeout) 

协程对象初始化(优先执行)

Parameters

integer $timeout

超时时间,单位毫秒

getResult()

getResult() : mixed|null

获取协程执行结果

Returns

mixed|null

throwTimeOutException()

throwTimeOutException() 

协程超时异常

Throws

\Exception

isTimeout()

isTimeout() : boolean

判断协程是否超时

Returns

boolean

nextRun()

nextRun() : boolean

通知调度器进行下一次迭代

Returns

boolean

destroy()

destroy() 

销毁

__unsleep()

__unsleep() : array

属性不用于序列化

Returns

array

breakx()

breakx() : boolean

发送异步请求后不需要执行回调

Returns

boolean

setTimeout()

setTimeout(integer  $timeout) : $this

手工设置超时时间

Parameters

integer $timeout

超时时间,单位毫秒

Returns

$this

send()

send(  $callback) 

发送异步请求

Parameters

$callback