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
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.
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