Package-level declarations

Utility functions for concurrent programming.

Functions

Link copied to clipboard
inline fun fixedRateTimer(name: String? = null, daemon: Boolean = false, startAt: Date, period: Long, crossinline action: TimerTask.() -> Unit): Timer

Creates a timer that executes the specified action periodically, starting at the specified startAt date and with the interval of period milliseconds between the start of the previous task and the start of the next one.

Since Kotlin 1.0
inline fun fixedRateTimer(name: String? = null, daemon: Boolean = false, initialDelay: Long = 0.toLong(), period: Long, crossinline action: TimerTask.() -> Unit): Timer

Creates a timer that executes the specified action periodically, starting after the specified initialDelay (expressed in milliseconds) and with the interval of period milliseconds between the start of the previous task and the start of the next one.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T : Any> ThreadLocal<T>.getOrSet(default: () -> T): T

Gets the value in the current thread's copy of this thread-local variable or replaces the value with the result of calling default function in case if that value was null.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> ReentrantReadWriteLock.read(action: () -> T): T

Executes the given action under the read lock of this lock.

Since Kotlin 1.0
Link copied to clipboard
inline fun Timer.schedule(time: Date, crossinline action: TimerTask.() -> Unit): TimerTask

Schedules an action to be executed at the specified time.

Since Kotlin 1.0
inline fun Timer.schedule(delay: Long, crossinline action: TimerTask.() -> Unit): TimerTask

Schedules an action to be executed after the specified delay (expressed in milliseconds).

Since Kotlin 1.0
inline fun Timer.schedule(time: Date, period: Long, crossinline action: TimerTask.() -> Unit): TimerTask

Schedules an action to be executed periodically, starting at the specified time and with the interval of period milliseconds between the end of the previous task and the start of the next one.

Since Kotlin 1.0
inline fun Timer.schedule(delay: Long, period: Long, crossinline action: TimerTask.() -> Unit): TimerTask

Schedules an action to be executed periodically, starting after the specified delay (expressed in milliseconds) and with the interval of period milliseconds between the end of the previous task and the start of the next one.

Since Kotlin 1.0
Link copied to clipboard
inline fun Timer.scheduleAtFixedRate(time: Date, period: Long, crossinline action: TimerTask.() -> Unit): TimerTask

Schedules an action to be executed periodically, starting at the specified time and with the interval of period milliseconds between the start of the previous task and the start of the next one.

Since Kotlin 1.0
inline fun Timer.scheduleAtFixedRate(delay: Long, period: Long, crossinline action: TimerTask.() -> Unit): TimerTask

Schedules an action to be executed periodically, starting after the specified delay (expressed in milliseconds) and with the interval of period milliseconds between the start of the previous task and the start of the next one.

Since Kotlin 1.0
Link copied to clipboard
fun thread(start: Boolean = true, isDaemon: Boolean = false, contextClassLoader: ClassLoader? = null, name: String? = null, priority: Int = -1, block: () -> Unit): Thread

Creates a thread that runs the specified block of code.

Since Kotlin 1.0
Link copied to clipboard
inline fun timer(name: String? = null, daemon: Boolean = false, startAt: Date, period: Long, crossinline action: TimerTask.() -> Unit): Timer

Creates a timer that executes the specified action periodically, starting at the specified startAt date and with the interval of period milliseconds between the end of the previous task and the start of the next one.

Since Kotlin 1.0
inline fun timer(name: String? = null, daemon: Boolean = false, initialDelay: Long = 0.toLong(), period: Long, crossinline action: TimerTask.() -> Unit): Timer

Creates a timer that executes the specified action periodically, starting after the specified initialDelay (expressed in milliseconds) and with the interval of period milliseconds between the end of the previous task and the start of the next one.

Since Kotlin 1.0
Link copied to clipboard
inline fun timerTask(crossinline action: TimerTask.() -> Unit): TimerTask

Wraps the specified action in a TimerTask.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> Lock.withLock(action: () -> T): T

Executes the given action under this lock.

Since Kotlin 1.0
Link copied to clipboard
inline fun <T> ReentrantReadWriteLock.write(action: () -> T): T

Executes the given action under the write lock of this lock.

Since Kotlin 1.0