Overview

Namespaces

  • Alchemy
    • core
      • query
      • schema
    • dialect
    • engine
    • orm
    • tests
    • util
      • promise
  • PHP

Classes

  • Promise
  • Signal
  • SignalFn_Then
  • Waitable

Interfaces

  • IPromisable

Exceptions

  • SerializableException
  • TimeoutException
  • TypeException
  • Overview
  • Namespace
  • Class
  • Tree

Class Waitable

Abstraction for objects which can be checked (non-blocking) or waited upon to resolve (blocking, with optional timeout).

Direct known subclasses

Alchemy\util\promise\Signal

Indirect known subclasses

Alchemy\util\promise\Promise
Namespace: Alchemy\util\promise
Located at alchemy/util/promise/Waitable.php
Methods summary
public
# __construct( mixed $type = null )
public mixed
# __invoke( )

Immediately return the value of the Waitable, resolved or not

Immediately return the value of the Waitable, resolved or not

Returns

mixed
current value
public boolean
# check( )

Returns whether or not the Waitable is resolved.

Returns whether or not the Waitable is resolved.

Returns

boolean
resolved or not
protected
# precheck( )

Subclasses override this to do something during check()

Subclasses override this to do something during check()

public this
# resolve( mixed $result )

Resolve the Waitable to a value, Exception, or NULL to leave it unresolved.

Resolve the Waitable to a value, Exception, or NULL to leave it unresolved.

Parameters

$result
mixed
$result

Returns

this
public
# timeout( integer $ms = 0, integer $spin = 10, boolean $reset = false )

Sets the timeout for this Waitable. $obj->timeout() will cause the Waitable to not wait at all.

Sets the timeout for this Waitable. $obj->timeout() will cause the Waitable to not wait at all.

Parameters

$ms
integer
$ms in milliseconds. 0 = immediately, null = never
$spin
integer
$spin delay between spinlock checks
$reset
boolean
$reset whether or not to reset the timer
public string|null
# type( )

Get the expected result type, if any, of this Waitable.

Get the expected result type, if any, of this Waitable.

Returns

string|null
public mixed
# wait( )

Blocks until either the Waitable resolves or times out.

Blocks until either the Waitable resolves or times out.

Returns

mixed
$result resolved value or an Exception
public mixed
# expect( )

Same as wait(), except it throws Exceptions instead of returning them.

Same as wait(), except it throws Exceptions instead of returning them.

Returns

mixed
$result resolved value
Properties summary
protected mixed $result null
#
protected mixed $started null
#
protected mixed $timeout null
#
protected integer $spin 10
#
API documentation generated by ApiGen 2.8.0