How would I make a coroutine suspend until an item...
# coroutines
j
How would I make a coroutine suspend until an item is not in a set
m
Encapsulate the set in an actor, and make it send a message to the suspended coroutine when the element is removed.
The coroutine could then suspend by calling
receive
on the channel.
j
Long story short I have a set of unique configs I only want one in use at a time, so when I lease it I add it to the set if someone else leases it I want it to block until it unlocks
n
broadcast which ones get unlocked.. then receive on that and check if it is the one it was waiting for.. broadcast a message that it is locked you could even make a map of channels.. one for each possible entry
j
hmmmmm
d
ActorModel to the rescue! Be warned though, that API is obsolete.