feat(event-manager): Added EventManager resume function.

This commit is contained in:
Niccolò Forlini
2024-10-23 13:58:02 +02:00
parent 690bee96c3
commit 19609f2c89
2 changed files with 11 additions and 0 deletions
@@ -452,6 +452,10 @@ class EventManagerImpl @AssistedInject constructor(
lock.withLock { internalStop() }
}
override suspend fun resume() {
lock.withLock { enqueueOrStop(immediately = true, failure = false) }
}
override suspend fun <R> suspend(block: suspend () -> R): R {
lock.withLock { return internalSuspend(block) }
}
@@ -51,6 +51,13 @@ interface EventManager {
*/
suspend fun stop()
/**
* Resume the Event loop execution.
*
* This call can be used to force the Event loop to run on demand, regardless of its existing schedule.
*/
suspend fun resume()
/**
* Pause the Event loop, calls the specified function [block], and resume the loop.
*