Hi, still working on my BLE GATT coroutines implem...
# coroutines
l
Hi, still working on my BLE GATT coroutines implementation, and I'd like to suspend all requests until the connection is restored or the connection is "manually" cancelled. How with kotlinx.coroutines can I suspend multiple coroutines from a single place? I'm looking for something like the following: A
Gate
class on which I'd have the following methods: - non suspending
lock()
which I'd call when the connection is suspended - non suspending
unlock()
which I'd call when the connection is reestablished -
passThroughWhenUnlocked()
that would suspend if the
Gate
instance is locked, and would resume when
unLock()
is called. This should allow multiple suspension points Is there something like this that exists, and if not, how could I make a class with this behavior? EDIT: The closest I found in the kotlinx.coroutines reference is
Mutex
which I can hijack with no-op lock then unlocks for the "pass through", and lock for long when the connection is suspended, until it is restored.