Package-level declarations
Types
This Flow will have behaviour very similar to SharedFlow, but there are several differences:
ExceptionHandler wrapper which was created to make possible to use handler across all coroutines calls
This key can (and will) be used to get ContextSafelyExceptionHandler from coroutineContext of suspend functions and in ContextSafelyExceptionHandler for defining of its CoroutineContext.Element.key
kotlinx.coroutines.flow.Flow-based android.view.ViewGroup.OnHierarchyChangeListener
It is interface which will work like classic Mutex, but in difference have lockStateFlow for listening of the SmartMutex state.
Composite mutex which works with next rules:
It is interface which will work like classic Semaphore, but in difference have permitsStateFlow for listening of the SmartSemaphore state.
Properties
This instance will be used in all calls of safely where exception handler has not been passed
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
Functions
Creates AccumulatorFlow using this with receiveAsFlow to get
Creates AccumulatorFlow using this as base Flow
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
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
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
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
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
Planned to use with doWithSuspending. Will execute incoming lambdas sequentially
Planned to use with doWithSuspending. Will execute incoming lambdas sequentially
Call this method in case you need to do something in common thread (like reading of file in JVM)
Must be use with actor created by createActionsActor or createSafeActionsActor. Will send lambda which will execute action and return result.
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
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
Launching runCatchingSafely with defaultSafelyExceptionHandler as onException
parameter
Launching block in runCatching. In case of failure, it will:
Calls safely with passing of defaultSafelyExceptionHandler as onException
Calls runCatchingSafely and getting the result via Result.getOrThrow
This method will set new coroutineContext with ContextSafelyExceptionHandler. In case if coroutineContext already contains ContextSafelyExceptionHandler, ContextSafelyExceptionHandler.handler will be used BEFORE contextExceptionHandler in case of exception.
Shortcut for safely with exception handler, that as expected must return null in case of impossible creating of result from exception (instead of throwing it, by default always returns null)
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
Use subscribe, but all blocks will be called inside of safely function. Use onException to set up your reaction for Throwables
Use subscribeSafelyWithoutExceptions, but all exceptions inside of safely will be skipped
Use subscribeSafelyWithoutExceptions, but all exceptions will be passed to defaultSafelyExceptionHandler
Will wait until the SmartSemaphore.permitsStateFlow of this instance will have permits count free permits.
Will wait until the SmartSemaphore.permitsStateFlow of this instance will have permits count free permits.
Will wait until the SmartMutex.lockStateFlow of this instance will be false.
Will wait until the SmartMutex.lockStateFlow of this instance will be false.
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
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
Will call SmartSemaphore.Mutable.lock, then execute action and return the result after SmartSemaphore.Mutable.unlock
Will call SmartMutex.Mutable.lock, then execute action and return the result after SmartMutex.Mutable.unlock
Will call SmartSemaphore.Mutable.lock, then execute action and return the result after SmartSemaphore.Mutable.unlock
Will call SmartMutex.Mutable.lock, then execute action and return the result after SmartMutex.Mutable.unlock