open class Sync
This class contains various static methods to allowing events and asynchronous results to be accessed in a synchronous way.
Author
Tim Fox
Sync()
This class contains various static methods to allowing events and asynchronous results to be accessed in a synchronous way. |
open static fun <T : Any> awaitEvent(consumer: Consumer<Handler<T>>): Topen static fun <T : Any> awaitEvent(consumer: Consumer<Handler<T>>, timeout: Long): T
Receive a single event from a handler synchronously. The fiber will be blocked until the event occurs. No kernel thread is blocked. |
|
open static fun <T : Any> awaitResult(consumer: Consumer<Handler<AsyncResult<T>>>): Topen static fun <T : Any> awaitResult(consumer: Consumer<Handler<AsyncResult<T>>>, timeout: Long): T
Invoke an asynchronous operation and obtain the result synchronous. The fiber will be blocked until the result is available. No kernel thread is blocked. |
|
open static fun <T : Any> fiberHandler(handler: Handler<T>): Handler<T>
Convert a standard handler to a handler which runs on a fiber. This is necessary if you want to do fiber blocking synchronous operations in your handler. |
|
open static fun getContextScheduler(): FiberScheduler
Get the `FiberScheduler` for the current context. There should be only one instance per context. |
|
open static fun removeContextScheduler(): Unit
Remove the scheduler for the current context |
|
open static fun <T : Any> streamAdaptor(): HandlerReceiverAdaptor<T>
Create an adaptor that converts a stream of events from a handler into a receiver which allows the events to be received synchronously. open static fun <T : Any> streamAdaptor(channel: Channel<T>): HandlerReceiverAdaptor<T>
Like |