All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.hnau.jutils.finisher.NewThreadFinisher.kt Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package ru.hnau.jutils.finisher

import kotlin.concurrent.thread


@Deprecated("Use kotlinx.coroutines.Deferred instead")
class NewThreadFinisher(
        action: (onFinished: (T) -> Unit) -> Unit
) : Finisher(
        { onFinished -> thread { action.invoke(onFinished) } }
) {

    companion object {

        fun  sync(action: () -> T) =
                NewThreadFinisher { onFinished ->
                    val result = action.invoke()
                    onFinished.invoke(result)
                }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy