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

ru.hnau.jutils.producer.locked_producer.FinishersLockedProducer.kt Maven / Gradle / Ivy

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

import ru.hnau.jutils.finisher.Finisher

@Deprecated("Use ru.hnau.jutils.producer.locked_producer.CompletableLockedProducer instead")
class FinishersLockedProducer : LockedProducer(
        isLocked = false
) {

    private var lockedCount = 0
        set(value) {
            field = value
            locked = value > 0
        }

    fun waitFinisher(finisher: Finisher<*>) {
        synchronized(this) { lockedCount++ }

        finisher.await {
            synchronized(this) { lockedCount-- }
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy