Documentation

ConcurrentIterator extends IteratorAggregate
in

Tags
template-covariant
template-extends

Table of Contents

Methods

continue()  : bool
Advances the iterator to the next position and value for the current fiber.
dispose()  : void
Disposes the iterator, indicating the consumer is no longer interested in the iterator output.
getIterator()  : Traversable<int, T>
getPosition()  : int
Returns the current position of the iterator for the current fiber.
getValue()  : T
Returns the current value of the iterator for the current fiber.
isComplete()  : bool

Methods

continue()

Advances the iterator to the next position and value for the current fiber.

public continue([Cancellation|null $cancellation = null ]) : bool

The position and value must be available via getPosition() and getValue() to the fiber calling continue() only.

A fiber calling continue() must not affect the position or value of other fibers.

If the iterator errors, the exception will be thrown from this method.

Parameters
$cancellation : Cancellation|null = null

Cancels waiting for the next value. If cancelled, the next value is not lost, but will be available to the next call to this method.

Return values
bool

true if a value is available, false if the iterator has completed.

dispose()

Disposes the iterator, indicating the consumer is no longer interested in the iterator output.

public dispose() : void

getIterator()

public getIterator() : Traversable<int, T>
Return values
Traversable<int, T>

Returns an iterator with getPosition() as key and getValue() as value. Multiple calls must be allowed to allow for concurrent iteration.

getPosition()

Returns the current position of the iterator for the current fiber.

public getPosition() : int

Advance the iterator to the next position using continue(), which must be called before this method may be called for each position.

Return values
int

The current position of the iterator. If the iterator has completed or continue() has not been called, an Error will be thrown.

getValue()

Returns the current value of the iterator for the current fiber.

public getValue() : T

Advance the iterator to the next value using continue(), which must be called before this method may be called for each value.

Return values
T

The current value of the iterator. If the iterator has completed or continue() has not been called, an Error will be thrown.

isComplete()

public isComplete() : bool
Return values
bool

true if the iterator has completed (either successfully or with an error) or false if the iterator may still emit more values.


        
On this page

Search results