Is there any way to suspend until some predicate i...
# announcements
a
Is there any way to suspend until some predicate is met, other than like a while loop?
z
By what mechanism does the value of the predicate change? Is there some callback or other notification? There are lots of integrations with existing reactive libraries. (also see the #coroutines channel)
a
Oops I missed that channel; the predicate is being changed by events recieved from the ktor websocket
z
What i meant was, how can you tell that the predicate’s value will have changed? Is there a callback or some other reactive signal, or do you have to poll the value?
a
I'm just polling it
z
Then yea, use a while loop. But also make sure to yield, which both ensures you participate in cooperative cancellation and allows other coroutines to run.