Properties

$instance

$instance : \Psc\Kernel

Type

Kernel

$mainSuspension

$mainSuspension : \Revolt\EventLoop\Suspension

Type

\Revolt\EventLoop\Suspension

Methods

__construct()

__construct() : mixed

Returns

mixed —

getInstance()

getInstance() : \Psc\Kernel

Returns

\Psc\Kernel —

await()

await(\Psc\Core\Coroutine\Promise  $promise) : mixed

Parameters

\Psc\Core\Coroutine\Promise $promise

Throws

\Throwable

Returns

mixed —

async()

async(\Closure  $closure) : \Psc\Core\Coroutine\Promise

async闭包中抛出的异常落地位置可能为调用上下文/挂起恢复处,因此对异常的管理要谨慎

Parameters

\Closure $closure

Returns

\Psc\Core\Coroutine\Promise —

promise()

promise(\Closure  $closure) : \Psc\Core\Coroutine\Promise

Parameters

\Closure $closure

Returns

\Psc\Core\Coroutine\Promise —

sleep()

sleep(int|float  $second) : void

Parameters

int|float $second

delay()

delay(\Closure  $closure, int|float  $second) : string

Parameters

\Closure $closure
int|float $second

Returns

string —

defer()

defer(\Closure  $closure) : void

Parameters

\Closure $closure

cancel()

cancel(string  $id) : void

Parameters

string $id

repeat()

repeat(\Closure  $closure, int|float  $second) : string

Parameters

\Closure $closure
int|float $second

Returns

string —

onSignal()

onSignal(int  $signal, \Closure  $closure) : string

Parameters

int $signal
\Closure $closure

Throws

\Revolt\EventLoop\UnsupportedFeatureException

Returns

string —

registerForkHandler()

registerForkHandler(\Closure  $closure) : int

Parameters

\Closure $closure

Returns

int —

cancelForkHandler()

cancelForkHandler(int  $index) : void

Parameters

int $index

run()

run() : void

tick()

tick() : bool

Returns

bool —

stop()

stop() : void

cancelAll()

cancelAll() : void

getIdentities()

getIdentities() : array

Returns

array —