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

main.kotlin.com.intuit.playerui.utils.test.ThreadUtils.kt Maven / Gradle / Ivy

There is a newer version: 0.10.1-next.0
Show newest version
package com.intuit.playerui.utils.test

public interface ThreadUtils {

    public val exceptions: MutableList
    public val threads: MutableList

    public fun addThreads(vararg threads: Thread) {
        threads.forEach {
            it.setUncaughtExceptionHandler { _, e -> exceptions.add(e); throw e }
            this.threads.add(it)
        }
    }

    public fun startThreads() {
        threads.forEach {
            if (it.state == Thread.State.NEW) it.start()
        }
    }

    public fun verifyThreads() {
        threads.forEach { it.join(10000) }
        exceptions.forEach { throw it }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy