Listener

gears.async.Listener
See theListener companion object
trait Listener[-T]

A listener, representing an one-time value receiver of an Async.Source.

Most of the time listeners should involve only calling a receiver function, and can be created by Listener.apply or Listener.acceptingListener.

However, should the listener want to attempt synchronization, it has to expose some locking-related interfaces. See Listener.lock.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def complete(data: T, source: Source[T]): Unit

Complete the listener with the given item, from the given source. If the listener exposes a Listener.ListenerLock, it is required to acquire this lock before calling complete. This can also be done conveniently with completeNow. For performance reasons, this condition is usually not checked and will end up causing unexpected behavior if not satisfied.

Complete the listener with the given item, from the given source. If the listener exposes a Listener.ListenerLock, it is required to acquire this lock before calling complete. This can also be done conveniently with completeNow. For performance reasons, this condition is usually not checked and will end up causing unexpected behavior if not satisfied.

The listener must automatically release its own lock upon completion.

Attributes

Concrete methods

final inline def acquireLock(): Boolean

Attempts to lock the listener, if such a lock exists. Succeeds with true immediately if lock is null.

Attempts to lock the listener, if such a lock exists. Succeeds with true immediately if lock is null.

Attributes

def completeNow(data: T, source: Source[T]): Boolean

Attempts to acquire locks and then calling complete with the given item and source. If locking fails, releaseLock is automatically called.

Attempts to acquire locks and then calling complete with the given item and source. If locking fails, releaseLock is automatically called.

Attributes

final inline def releaseLock(): Unit

Release the listener's lock if it exists.

Release the listener's lock if it exists.

Attributes

Abstract fields

val lock: ListenerLock | Null

Represents the exposed API for synchronization on listeners at receiving time. If the listener does not have any form of synchronization, lock should be null.

Represents the exposed API for synchronization on listeners at receiving time. If the listener does not have any form of synchronization, lock should be null.

Attributes