Package-level declarations

Types

Link copied to clipboard
class AccumulatorFlow<T>(sourceDataFlow: Flow<T>, scope: CoroutineScope) : AbstractFlow<T>

This Flow will have behaviour very similar to SharedFlow, but there are several differences:

Link copied to clipboard
interface ActorAction<T>
Link copied to clipboard

ExceptionHandler wrapper which was created to make possible to use handler across all coroutines calls

Link copied to clipboard
class DeferredAction<T, O>(val deferred: Deferred<T>, val callback: suspend (T) -> O)

Represents a deferred action that combines a Deferred value with a callback to be executed on that value.

Link copied to clipboard
class DoWithFirstBuilder<T>(scope: CoroutineScope)

A builder for creating multiple deferred computations that can be executed, with only the first completing one being used. This is useful for race conditions where you want the result of whichever computation finishes first.

Link copied to clipboard
typealias ExceptionHandler<T> = suspend (Throwable) -> T
Link copied to clipboard
class FlowOnHierarchyChangeListener(recursive: Boolean = false, _onChildViewAdded: MutableSharedFlow<Pair<View, View>> = MutableSharedFlow(extraBufferCapacity = Int.MAX_VALUE), _onChildViewRemoved: MutableSharedFlow<Pair<View, View>> = MutableSharedFlow(extraBufferCapacity = Int.MAX_VALUE)) : ViewGroup.OnHierarchyChangeListener

kotlinx.coroutines.flow.Flow-based android.view.ViewGroup.OnHierarchyChangeListener

Link copied to clipboard
open class MutableRedeliverStateFlow<T>(initialValue: T) : MutableStateFlow<T> , FlowCollector<T> , MutableSharedFlow<T>

Works like StateFlow, but guarantee that latest value update will always be delivered to each active subscriber

Link copied to clipboard
class SmartKeyRWLocker<T>(globalLockerReadPermits: Int = Int.MAX_VALUE, globalLockerWriteIsLocked: Boolean = false, perKeyReadPermits: Int = Int.MAX_VALUE)

Combining globalRWLocker and internal map of SmartRWLocker associated by T to provide next logic:

Link copied to clipboard
sealed interface SmartMutex

It is interface which will work like classic Mutex, but in difference have lockStateFlow for listening of the SmartMutex state.

Link copied to clipboard
class SmartRWLocker(readPermits: Int = Int.MAX_VALUE, writeIsLocked: Boolean = false)

Composite mutex which works with next rules:

Link copied to clipboard
sealed interface SmartSemaphore

It is interface which will work like classic Semaphore, but in difference have permitsStateFlow for listening of the SmartSemaphore state.

Properties

Link copied to clipboard
val <T> T.asDeferred: Deferred<T>

Wraps this value in a completed Deferred. The resulting Deferred is immediately completed with this value. Useful for converting synchronous values to Deferred in contexts that expect deferred values.

Link copied to clipboard
val Default: CoroutineDispatcher

Convenience property to access Dispatchers.Default for CPU-intensive operations.

Link copied to clipboard

This instance will be used in all calls of safely where exception handler has not been passed

Link copied to clipboard

This instance will be used in all calls of safelyWithoutExceptions as an exception handler for safely call

Use this handler in cases you wish to include handling of exceptions by defaultSafelyWithoutExceptionHandler and returning null at one time

Link copied to clipboard
val IO: CoroutineDispatcher

Convenience property to access Dispatchers.IO for I/O-bound operations. This dispatcher is optimized for offloading blocking I/O tasks to a shared pool of threads.

Link copied to clipboard
val UI: MainCoroutineDispatcher

Convenience property to access Dispatchers.Main for UI operations.

Functions

Link copied to clipboard
fun <T> Channel<T>.accumulatorFlow(scope: CoroutineScope): Flow<T>

Creates AccumulatorFlow using this with receiveAsFlow to get

fun <T> Flow<T>.accumulatorFlow(scope: CoroutineScope): Flow<T>

Creates AccumulatorFlow using this as base Flow

Link copied to clipboard
fun <T> CoroutineScope.actor(channelCapacity: Int = Channel.UNLIMITED, block: suspend (T) -> Unit): Channel<T>

Creates an actor using coroutines that processes incoming messages of type T. An actor is a computational entity that processes messages sequentially in response to messages it receives.

Link copied to clipboard
fun <T> CoroutineScope.actorAsync(channelCapacity: Int = Channel.UNLIMITED, markerFactory: suspend (T) -> Any? = { null }, logger: KSLog = KSLog, block: suspend (T) -> Unit): Channel<T>

Creates an actor-style channel that processes messages asynchronously based on markers. Messages with the same marker will be processed sequentially, while messages with different markers can be processed concurrently.

Link copied to clipboard
inline suspend fun alsoWithUnlockingOnSuccess(vararg lockers: SmartRWLocker, block: suspend () -> Unit): Result<Unit>

Executes the given block and unlocks all provided lockers for writing if the block succeeds. If the block throws an exception, the lockers will remain locked.

Link copied to clipboard
fun alsoWithUnlockingOnSuccessAsync(scope: CoroutineScope, vararg lockers: SmartRWLocker, block: suspend () -> Unit): Job

Asynchronously executes the given block and unlocks all provided lockers for writing if the block succeeds. This function launches a new coroutine in the given scope and automatically logs and drops any exceptions.

Link copied to clipboard
fun <T> CoroutineScope.asyncLogging(errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> T): Deferred<T>

Creates a new async coroutine with automatic exception logging. If an exception occurs, it will be logged using the provided logger and then rethrown when the Deferred is awaited.

Link copied to clipboard
fun <T> CoroutineScope.asyncLoggingDropExceptions(errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> T): Deferred<Result<T>>

Creates a new async coroutine with automatic exception logging and dropping. If an exception occurs, it will be logged using the provided logger and wrapped in a Result, which can be checked when the Deferred is awaited.

Link copied to clipboard
fun <T> CoroutineScope.asyncWeak(context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> T): Deferred<T>

this will be used as base for WeakScope. Other parameters (context, start, block) will be used to create async

Link copied to clipboard
suspend fun <T> awaitFirst(vararg deferreds: Deferred<T>, cancelOthers: Boolean = true): T

Trying to Deferred.await on all deferreds. The first Deferred completed its work will interrupt all others awaits and, if cancelOthers passed as true (by default), will also cancel all the others deferreds

suspend fun <T> awaitFirst(vararg deferreds: Deferred<T>, scope: CoroutineScope, cancelOnResult: Boolean = true): T

Trying to Deferred.await on all deferreds. The first Deferred completed its work will interrupt all others awaits and, if cancelOnResult passed as true (by default), will also cancel all the others deferreds

Link copied to clipboard
suspend fun <T> Iterable<Deferred<T>>.awaitFirst(cancelOthers: Boolean = true): T

Trying to Deferred.await on all thiss. The first Deferred completed its work will interrupt all others awaits and, if cancelOthers passed as true (by default), will also cancel all the others Deferreds

suspend fun <T> Iterable<Deferred<T>>.awaitFirst(scope: CoroutineScope, cancelOnResult: Boolean = true): T

Trying to Deferred.await on all thiss. The first Deferred completed its work will interrupt all others awaits and, if cancelOnResult passed as true (by default), will also cancel all the others Deferreds

Link copied to clipboard
suspend fun <T> Iterable<Deferred<T>>.awaitFirstWithDeferred(scope: CoroutineScope, cancelOnResult: Boolean = true): Pair<Deferred<T>, T>

Trying to Deferred.await on all thiss. The first Deferred completed its work will interrupt all others awaits and, if cancelOnResult passed as true (by default), will also cancel all the others Deferreds

Link copied to clipboard
fun <T, O> Deferred<T>.buildAction(callback: suspend (T) -> O): DeferredAction<T, O>

Creates a DeferredAction from this Deferred and a callback function.

Link copied to clipboard
fun CoroutineScopeWithDefaultFallback(context: CoroutineContext, defaultExceptionsHandler: ExceptionHandler<Unit>): CoroutineScope
Link copied to clipboard
fun CoroutineScope.createActionsActor(): Channel<suspend () -> Unit>

Planned to use with doWithSuspending. Will execute incoming lambdas sequentially

Link copied to clipboard
inline fun CoroutineScope.createSafeActionsActor(noinline onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler): Channel<suspend () -> Unit>

Planned to use with doWithSuspending. Will execute incoming lambdas sequentially

Link copied to clipboard
fun <T> Flow<T>.debouncedBy(timeout: (T) -> Long, markerFactory: (T) -> Any?): Flow<T>

Debounces a Flow with per-marker timeout control. Values with the same marker will be debounced independently. For each marker, only the last value within the timeout period will be emitted.

fun <T> Flow<T>.debouncedBy(timeout: Long, markerFactory: (T) -> Any?): Flow<T>

Debounces a Flow with a fixed timeout in milliseconds and per-marker control. Values with the same marker will be debounced independently.

fun <T> Flow<T>.debouncedBy(timeout: Duration, markerFactory: (T) -> Any?): Flow<T>

Debounces a Flow with a fixed timeout as Duration and per-marker control. Values with the same marker will be debounced independently.

Link copied to clipboard
inline suspend fun <T> doIn(context: CoroutineContext, noinline block: suspend CoroutineScope.() -> T): T

Executes the given block in the specified coroutine context and returns its result. This is a convenience wrapper around withContext.

Link copied to clipboard
inline suspend fun <T> doInDefault(noinline block: suspend CoroutineScope.() -> T): T

Executes the given block on the Default dispatcher and returns its result. This is a convenience function for executing CPU-intensive operations.

Link copied to clipboard
inline suspend fun <T> doInIO(noinline block: suspend CoroutineScope.() -> T): T

Executes the given block on the IO dispatcher and returns its result. This is a convenience function for executing I/O-bound operations like reading files, network requests, or database queries.

Link copied to clipboard
inline suspend fun <T> doInUI(noinline block: suspend CoroutineScope.() -> T): T

Executes the given block on the UI/Main dispatcher and returns its result. This is a convenience function for executing UI operations.

Link copied to clipboard
suspend fun <T> doOutsideOfCoroutine(block: () -> T): T

Call this method in case you need to do something in common thread (like reading of file in JVM)

Link copied to clipboard
fun <T> doSynchronously(block: suspend CoroutineScope.() -> T): T

Alias for launchSynchronously. Launches a coroutine in a new scope and blocks the current thread until it completes.

Link copied to clipboard
fun <T> CoroutineScope.doSynchronously(block: suspend CoroutineScope.() -> T): T

Alias for launchSynchronously. Launches a coroutine and blocks the current thread until it completes.

Link copied to clipboard
suspend fun <T> Channel<suspend () -> Unit>.doWithSuspending(action: ActorAction<T>): T

Must be use with actor created by createActionsActor or createSafeActionsActor. Will send lambda which will execute action and return result.

Link copied to clipboard
fun <T> Flow<T>.filterNotNull(): Flow<T & Any>

Alias for takeNotNull. Filters out null values from this Flow, returning only non-null elements.

Link copied to clipboard
suspend fun <T> List<Deferred<T>>.first(scope: CoroutineScope, cancelOnResult: Boolean = true): T

Returns the value of the first Deferred from this list to complete, using the given scope. Other deferred values are cancelled if cancelOnResult is true.

Link copied to clipboard
suspend fun <T> Flow<T?>.firstNotNull(): T & Any

Returns the first non-null element emitted by this Flow. Suspends until a non-null element is found.

Link copied to clipboard
suspend fun <T> CoroutineScope.firstOf(cancelOnResult: Boolean = true, block: DoWithFirstBuilder<T>.() -> Unit): T

Builds multiple deferred computations using DoWithFirstBuilder and returns the value of the first one to complete. Other deferred computations are cancelled if cancelOnResult is true.

suspend fun <T> CoroutineScope.firstOf(variants: Iterable<Deferred<T>>, cancelOnResult: Boolean = true): T
suspend fun <T> CoroutineScope.firstOf(vararg variants: Deferred<T>, cancelOnResult: Boolean = true): T

Returns the value of the first Deferred from the given variants to complete. Other deferred values are cancelled if cancelOnResult is true.

Link copied to clipboard
@JvmName(name = "flatMapIterable")
inline fun <T, R> Flow<Iterable<T>>.flatMap(crossinline mapper: suspend (T) -> R): Flow<R>

Transforms each element from inner Iterables using the given mapper function and flattens the result into a single Flow.

inline fun <T, R> Flow<Flow<T>>.flatMap(crossinline mapper: suspend (T) -> R): Flow<R>

Transforms each inner Flow element using the given mapper function and flattens the result into a single Flow.

Link copied to clipboard
@JvmName(name = "flatMapNotNullIterable")
inline fun <T, R> Flow<Iterable<T>>.flatMapNotNull(crossinline mapper: suspend (T) -> R): Flow<R & Any>

Transforms each element from inner Iterables using the given mapper function, flattens the result, and filters out null values.

inline fun <T, R> Flow<Flow<T>>.flatMapNotNull(crossinline mapper: suspend (T) -> R): Flow<R & Any>

Transforms each inner Flow element using the given mapper function, flattens the result, and filters out null values.

Link copied to clipboard
@JvmName(name = "flattenIterable")
fun <T> Flow<Iterable<T>>.flatten(): Flow<T>

Flattens a Flow of Iterables into a single Flow by emitting all elements from each iterable.

fun <T> Flow<Flow<T>>.flatten(): Flow<T>

Flattens a Flow of Flows into a single Flow by collecting all inner flows sequentially.

Link copied to clipboard
inline suspend operator fun <T> FlowCollector<T>.invoke(value: T)

Operator function that allows a FlowCollector to be invoked like a function to emit a value. This is a convenient syntax sugar for FlowCollector.emit.

Link copied to clipboard
suspend fun <O> invokeFirstOf(scope: CoroutineScope, vararg variants: DeferredAction<*, O>, cancelOnResult: Boolean = true): O

Invokes the first DeferredAction from the given variants whose deferred value completes, executing its callback and returning the result. Other deferred actions are cancelled if cancelOnResult is true.

Link copied to clipboard
suspend fun <O> Iterable<DeferredAction<*, O>>.invokeFirstOf(scope: CoroutineScope, cancelOnResult: Boolean = true): O

Invokes the first DeferredAction whose deferred value completes, executing its callback and returning the result. Other deferred actions are cancelled if cancelOnResult is true.

Link copied to clipboard
suspend fun <T, O> invokeOnFirst(scope: CoroutineScope, vararg variants: Deferred<T>, cancelOnResult: Boolean = true, callback: suspend (T) -> O): O

Awaits the first Deferred from the given variants to complete and invokes the callback on its value. Other deferred values are cancelled if cancelOnResult is true.

Link copied to clipboard
suspend fun <T, O> Iterable<Deferred<T>>.invokeOnFirst(scope: CoroutineScope, cancelOnResult: Boolean = true, callback: suspend (T) -> O): O

Awaits the first Deferred to complete and invokes the callback on its value. Other deferred values are cancelled if cancelOnResult is true.

Link copied to clipboard
suspend fun <T, O> CoroutineScope.invokeOnFirstOf(cancelOnResult: Boolean = true, block: DoWithFirstBuilder<T>.() -> Unit, callback: suspend (T) -> O): O

Builds multiple deferred computations using DoWithFirstBuilder and invokes callback on the first one to complete. Other deferred computations are cancelled if cancelOnResult is true.

Link copied to clipboard
suspend fun joinFirst(vararg jobs: Job, cancelOthers: Boolean = true): Job
suspend fun joinFirst(vararg jobs: Job, scope: CoroutineScope, cancelOthers: Boolean = true): Job

Trying to Job.join on all jobs. The first Job completed its work will interrupt all others joins and, if cancelOthers passed as true (by default), will also cancel all the others Jobs

Link copied to clipboard
suspend fun Iterable<Job>.joinFirst(cancelOthers: Boolean = true): Job
suspend fun Iterable<Job>.joinFirst(scope: CoroutineScope, cancelOthers: Boolean = true): Job

Trying to Job.join on all thiss. The first Job completed its work will interrupt all others joins and, if cancelOthers passed as true (by default), will also cancel all the others Jobs

Link copied to clipboard
fun <T> launchInCurrentThread(block: suspend CoroutineScope.() -> T): T

Launches a coroutine in the current thread using Dispatchers.Unconfined and blocks until it completes, returning its result. The coroutine will start execution in the current thread and will continue in the same thread until the first suspension point.

Link copied to clipboard
fun CoroutineScope.launchLogging(errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> Unit): Job

Launches a new coroutine with automatic exception logging. If an exception occurs, it will be logged using the provided logger and then rethrown.

Link copied to clipboard
fun CoroutineScope.launchLoggingDropExceptions(errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> Unit): Job

Launches a new coroutine with automatic exception logging and dropping. If an exception occurs, it will be logged using the provided logger and then dropped (not rethrown), allowing the coroutine to complete normally.

Link copied to clipboard
fun <T> launchSynchronously(block: suspend CoroutineScope.() -> T): T

Launches a coroutine in a new CoroutineScope with Dispatchers.Default and blocks the current thread until the coroutine completes, returning its result.

Link copied to clipboard
fun <T> CoroutineScope.launchSynchronously(block: suspend CoroutineScope.() -> T): T

Launches a coroutine and blocks the current thread until the coroutine completes, returning its result. This is useful for bridging between suspending and non-suspending code in JVM environments. The coroutine is launched with CoroutineStart.UNDISPATCHED to start execution immediately.

Link copied to clipboard
fun CoroutineScope.launchWeak(context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> Unit): Job

this will be used as base for WeakScope. Other parameters (context, start, block) will be used to launch

Link copied to clipboard

Creates a SupervisorJob linked to this CoroutineContext's job. The new supervisor job will be a child of the current job, and optionally combined with additionalContext.

fun CoroutineScope.LinkedSupervisorJob(additionalContext: CoroutineContext? = null): CoroutineContext

Creates a SupervisorJob linked to this CoroutineScope's job. The new supervisor job will be a child of the current scope's job, and optionally combined with additionalContext.

Link copied to clipboard
fun CoroutineContext.LinkedSupervisorScope(additionalContext: CoroutineContext? = null): CoroutineScope

Creates a new CoroutineScope with a SupervisorJob linked to this CoroutineContext's job. The new scope's supervisor job will be a child of the current job, and optionally combined with additionalContext.

fun CoroutineScope.LinkedSupervisorScope(additionalContext: CoroutineContext? = null): CoroutineScope

Creates a new CoroutineScope with a SupervisorJob linked to this CoroutineScope's job. The new scope's supervisor job will be a child of the current scope's job, and optionally combined with additionalContext.

Link copied to clipboard
inline operator fun <T> Flow<T>.plus(other: Flow<T>): Flow<T>

Merges two flows into a single flow. Values from both flows will be emitted as they become available. This is a convenient operator syntax for merge.

Link copied to clipboard
suspend fun preloadImage(src: String): Image
Link copied to clipboard
inline fun <T> Result<T>.replaceIfFailure(onException: (Throwable) -> T): Result<T>

Replaces a failed Result with a new value computed from the exception. If this Result is successful, it is returned as-is. If it represents a failure, the onException handler is called with the exception to compute a replacement value, which is then wrapped in a new Result.

Link copied to clipboard
inline fun <T, R> R.runCatchingLogging(noinline errorMessageBuilder: R.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, block: R.() -> T): Result<T>

Executes the given block within a runCatching context and logs any exceptions that occur, excluding CancellationException which is rethrown. This method simplifies error handling by automatically logging the errors using the provided logger.

Link copied to clipboard
inline fun <T> CoroutineScope.safeActor(channelCapacity: Int = Channel.UNLIMITED, noinline onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler, crossinline block: suspend (T) -> Unit): Channel<T>

Creates a safe actor that catches and handles exceptions during message processing. This variant wraps the processing logic in a safety mechanism to prevent actor failure due to exceptions.

Link copied to clipboard
suspend fun selectFileOrNull(inputSetup: (HTMLInputElement) -> Unit = {}, onFailure: (Throwable) -> Unit = {}): MPPFile?
Link copied to clipboard
suspend fun selectFileOrThrow(inputSetup: (HTMLInputElement) -> Unit = {}): MPPFile
Link copied to clipboard

Use ViewGroup.setOnHierarchyChangeListener recursively for all available ViewGroups starting with this. This extension DO NOT guarantee that recursive subscription will happen after this method call

Link copied to clipboard
inline fun <T> Flow<T>.subscribe(scope: CoroutineScope, noinline block: suspend (T) -> Unit): Job

Shortcut for chain if Flow.onEach and Flow.launchIn

Link copied to clipboard
fun <T, M> Flow<T>.subscribeAsync(scope: CoroutineScope, markerFactory: suspend (T) -> M, logger: KSLog = KSLog, block: suspend (T) -> Unit): Job

Subscribes to a Flow with asynchronous processing based on markers. Each value from the flow will be processed by the block function. Values with the same marker will be processed sequentially in the same coroutine scope, while values with different markers can be processed concurrently in separate coroutine scopes.

Link copied to clipboard
inline fun <T> Flow<T>.subscribeLogging(scope: CoroutineScope, noinline errorMessageBuilder: T.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, noinline block: suspend (T) -> Unit): Job

Use subscribe, but all blocks will be called inside of safely function. Use onException to set up your reaction for Throwables

Link copied to clipboard
inline fun <T> Flow<T>.subscribeLoggingDropExceptions(scope: CoroutineScope, noinline errorMessageBuilder: T.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, noinline block: suspend (T) -> Unit): Job

Use subscribeSafelyWithoutExceptions, but all exceptions will be passed to defaultSafelyExceptionHandler

Link copied to clipboard
fun <T, M> Flow<T>.subscribeLoggingDropExceptionsAsync(scope: CoroutineScope, markerFactory: suspend (T) -> M, logger: KSLog = KSLog, block: suspend (T) -> Unit): Job

Subscribes to a Flow with asynchronous processing based on markers, automatically logging and dropping exceptions. Each value from the flow will be processed by the block function. Values with the same marker will be processed sequentially, while values with different markers can be processed concurrently. Any exceptions thrown during processing will be logged and dropped without affecting other messages.

Link copied to clipboard
suspend fun suspendPoint()

Ensures that the current coroutine context is still active and throws a kotlinx.coroutines.CancellationException if the coroutine has been canceled.

Link copied to clipboard
fun <T> Flow<T>.takeNotNull(): Flow<T & Any>

Filters out null values from this Flow, returning only non-null elements.

Link copied to clipboard
suspend fun Blob.toByteArray(): ByteArray
Link copied to clipboard
Link copied to clipboard
suspend fun SmartRWLocker.waitReadRelease(permits: Int = 1): Int

Will wait until the SmartSemaphore.permitsStateFlow of this instance will have permits count free permits.

Link copied to clipboard
suspend fun SmartSemaphore.waitRelease(permits: Int = 1): Int

Will wait until the SmartSemaphore.permitsStateFlow of this instance will have permits count free permits.

Link copied to clipboard
Link copied to clipboard

Will wait until the SmartMutex.lockStateFlow of this instance will be false.

Link copied to clipboard

Will wait until the SmartMutex.lockStateFlow of this instance will be false.

Link copied to clipboard
fun WeakScope(context: CoroutineContext): CoroutineScope

Created CoroutineScope which will launch listening of context job completing and drop itself. Current weak scope will not be attached to context directly. So, this CoroutineScope will not prevent parent one from cancelling if it is launched with supervisorScope or coroutineScope, but still will follow closing status of parent Job

fun WeakScope(scope: CoroutineScope): CoroutineScope

Created CoroutineScope which will launch listening of scope job completing and drop itself. Current weak scope will not be attached to scope directly. So, this CoroutineScope will not prevent parent one from cancelling if it is launched with supervisorScope or coroutineScope, but still will follow closing status of parent Job

Link copied to clipboard
inline suspend fun <T> SmartSemaphore.Mutable.withAcquire(permits: Int = 1, action: () -> T): T

Will call SmartSemaphore.Mutable.lock, then execute action and return the result after SmartSemaphore.Mutable.unlock

Link copied to clipboard
inline suspend fun <T> SmartMutex.Mutable.withLock(action: () -> T): T

Will call SmartMutex.Mutable.lock, then execute action and return the result after SmartMutex.Mutable.unlock

Link copied to clipboard
inline suspend fun <T, R> SmartKeyRWLocker<T>.withReadAcquire(action: () -> R): R
inline suspend fun <T, R> SmartKeyRWLocker<T>.withReadAcquire(key: T, action: () -> R): R

inline suspend fun <T> SmartRWLocker.withReadAcquire(action: () -> T): T

Will call SmartSemaphore.Mutable.lock, then execute action and return the result after SmartSemaphore.Mutable.unlock

Link copied to clipboard
inline suspend fun <T, R> SmartKeyRWLocker<T>.withReadAcquires(keys: Iterable<T>, action: () -> R): R
inline suspend fun <T, R> SmartKeyRWLocker<T>.withReadAcquires(vararg keys: T, action: () -> R): R
Link copied to clipboard
inline suspend fun <T, R> SmartKeyRWLocker<T>.withWriteLock(action: () -> R): R
inline suspend fun <T, R> SmartKeyRWLocker<T>.withWriteLock(key: T, action: () -> R): R

inline suspend fun <T> SmartRWLocker.withWriteLock(action: () -> T): T

Will call SmartMutex.Mutable.lock, then execute action and return the result after SmartMutex.Mutable.unlock

Link copied to clipboard
inline suspend fun <T, R> SmartKeyRWLocker<T>.withWriteLocks(keys: Iterable<T>, action: () -> R): R
inline suspend fun <T, R> SmartKeyRWLocker<T>.withWriteLocks(vararg keys: T, action: () -> R): R