W3cubDocs

/Kotlin

park

Platform and version requirements: Native (1.3)
fun park(
    timeoutMicroseconds: Long, 
    process: Boolean = false
): Boolean

Park execution of the current worker until a new request arrives or timeout specified in timeoutMicroseconds elapsed. If process is true, pending queue elements are processed, including delayed requests. Note that multiple requests could be processed this way.

Parameters

timeoutMicroseconds - defines how long to park worker if no requests arrive, waits forever if -1.

process - defines if arrived request(s) shall be processed.

Exceptions

IllegalStateException - if this request is executed on non-current Worker.

IllegalArgumentException - if timeout value is incorrect.

Return if process is true: if request(s) was processed true and false otherwise. if process is false: true if request(s) has arrived and false if timeout happens.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-worker/park.html