WorkStealingQueue

A WorkStealingQueue tracks parallelism separate subqueues of tasks. Each Interpreter feeds and consumes a distinct subqueue dedicated to that interpreter thread, ideally without contention from other threads. When a subqueue is exhausted, the requesting thread will examine the other threads' queues and steal one for itself. Only at that point will contention occur.

Each subqueue is maintained in priority order, but the aggregate collection of queues cannot be considered strictly ordered.

Constructors

Link copied to clipboard
constructor(parallelism: Int)

Properties

Link copied to clipboard
open override val size: Int

Functions

Link copied to clipboard
abstract override fun add(element: E): Boolean
Link copied to clipboard
abstract fun addAll(elements: Collection<E>): Boolean
Link copied to clipboard
abstract fun clear()
Link copied to clipboard
abstract operator override fun contains(element: E): Boolean
Link copied to clipboard
abstract fun containsAll(elements: Collection<E>): Boolean
Link copied to clipboard
open override fun drainTo(c: MutableCollection<in E>): Int
open override fun drainTo(c: MutableCollection<in E>, maxElements: Int): Int
Link copied to clipboard
abstract fun element(): E
Link copied to clipboard
open fun forEach(p0: Consumer<in E>)
Link copied to clipboard
abstract fun isEmpty(): Boolean
Link copied to clipboard
open operator override fun iterator(): MutableIterator<E>
Link copied to clipboard
inline fun <T, R> Iterable<T>.mapToSet(destination: MutableSet<R> = mutableSetOf(), transform: (T) -> R): MutableSet<R>

Transform the receiver via the supplied function and collect the results into an optionally provided set. Answer the result set.

Link copied to clipboard
open override fun offer(element: E): Boolean
open override fun offer(e: E, timeout: Long, unit: TimeUnit): Boolean
Link copied to clipboard
fun <E> Collection<E>.parallelDoThen(action: (E, () -> Unit) -> Unit, then: () -> Unit)

For each element in the collection, execute the action, passing a zero-argument function to run exactly once afterward (in this Thread or another). When the last element's zero-argument function has been invoked, or immediately if the collection is empty, invoke then.

Link copied to clipboard
inline fun <S, T> Collection<S>.parallelMapThen(crossinline action: (S, afterEach: (T) -> Unit) -> Unit, crossinline then: (List<T>) -> Unit)

For each element in the collection, execute the action, passing a zero-argument function to run exactly once afterward (in this Thread or another). When the last element's zero-argument function has been invoked, or immediately if the collection is empty, invoke then.

Link copied to clipboard
open fun parallelStream(): Stream<E>
Link copied to clipboard
open override fun peek(): E?
Link copied to clipboard
open override fun poll(): E?
open override fun poll(timeout: Long, unit: TimeUnit): E?
Link copied to clipboard
open override fun put(e: E)
Link copied to clipboard
open override fun remainingCapacity(): Int
Link copied to clipboard
open override fun remove(element: E): Boolean
abstract fun remove(): E
Link copied to clipboard
abstract fun removeAll(elements: Collection<E>): Boolean
Link copied to clipboard
open fun removeIf(p0: Predicate<in E>): Boolean
Link copied to clipboard
abstract fun retainAll(elements: Collection<E>): Boolean
Link copied to clipboard
open override fun spliterator(): Spliterator<E>
Link copied to clipboard
open fun stream(): Stream<E>
Link copied to clipboard
open override fun take(): E
Link copied to clipboard
open fun toArray(): Array<Any>
open fun <T : Any> toArray(p0: Array<T>): Array<T>
open fun <T : Any> toArray(p0: IntFunction<Array<T>>): Array<T>