How would I make a coroutine suspend until an item is not in a set
m
marstran
02/07/2019, 11:01 AM
Encapsulate the set in an actor, and make it send a message to the suspended coroutine when the element is removed.
marstran
02/07/2019, 11:01 AM
The coroutine could then suspend by calling
receive
on the channel.
j
jkbbwr
02/07/2019, 11:02 AM
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
Nikky
02/07/2019, 11:09 AM
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
jkbbwr
02/07/2019, 11:20 AM
hmmmmm
d
dewildte
02/07/2019, 10:38 PM
ActorModel to the rescue!
Be warned though, that API is obsolete.