class CoroutineState implements NonCopyableContext

Keep transfers and their cancellation callbacks within their owning coroutine.

Constants

protected CONTEXT_KEY

Properties

TaskQueue $queue
protected PromiseInterface> $promises

Methods

__construct()

Create a queue whose lifetime follows its coroutine rather than the process.

static CoroutineState|null
current()

Get the current coroutine's state without creating it.

static CoroutineState
forCurrent()

Get the current coroutine's state and register owner-exit cleanup.

void
track(PromiseInterface $promise)

Retain pending transport work in its owner's context until it settles.

void
cancel()

Cancel unfinished transport work.

void
finish()

Finish cancellation and queued callbacks before reporting cleanup failures.

Details

at line 29
__construct()

Create a queue whose lifetime follows its coroutine rather than the process.

at line 37
static CoroutineState|null current()

Get the current coroutine's state without creating it.

Return Value

CoroutineState|null

at line 45
static CoroutineState forCurrent()

Get the current coroutine's state and register owner-exit cleanup.

Return Value

CoroutineState

at line 63
void track(PromiseInterface $promise)

Retain pending transport work in its owner's context until it settles.

Parameters

PromiseInterface $promise

Return Value

void

at line 77
void cancel()

Cancel unfinished transport work.

Return Value

void

at line 88
void finish()

Finish cancellation and queued callbacks before reporting cleanup failures.

Return Value

void