Job

A data structure to pass a payload and a callback job safely between threads by freezing its contents. The payload of type Input can be used by the consumer of this object for processing. The result of the processing of type Output can then be posted on a non capturing lambda job as argument.

Examples

val safeJob = ThreadTransferableJob.create("Hello") {it: Int ->
assertEquals("Hello".hashCode(), it)
}

// other thread which receives job as argument.

safeJob.job(safeJob.payload.hashCode())

class Job<Input, Output>

Types

Companion
Link copied to clipboard
common
object Companion

Functions

equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
toString
Link copied to clipboard
common
open override fun toString(): String

Properties

job
Link copied to clipboard
common

A job to be executed by the target thread

val job: (Output) -> Unit
payload
Link copied to clipboard
common

A payload to be consumed by thread to which job is being transferred to.

val payload: Input