Anyone have a simple implementation for a suspending CountDownLatch?
g
gildor
08/21/2019, 4:38 PM
What is your case for this? Maybe existing suspend Semaphore or other primitive will work for you
l
Luis Munoz
08/21/2019, 4:41 PM
I have a suspending connect function and after I connect and send credentials I want to suspend until I received a success but this happens in a generic data handler which will unlatch
separate from the connect function
m
Marko Mitic
08/21/2019, 4:42 PM
Semaphore can work there
l
Luis Munoz
08/21/2019, 4:44 PM
thank you looking at docs now
g
gildor
08/21/2019, 4:44 PM
Also if you have only one lock just use suspend Mutex
Also standard fan-in/fan-out pattern will work, but probably it requires quite different structure of code on your sidd
d
David Glasser
08/21/2019, 5:19 PM
Also coroutineScope can solve many of the concerns of CDL though maybe not this specific one