krotki
02/27/2018, 1:17 PMJoe
02/27/2018, 5:09 PMbj0
02/27/2018, 5:55 PMsuspend fun <T> BroadcastChannel<T>.waitUntil(value: T): T {
consume {
for (element in this)
if (element == value)
return value
}
throw CancellationException("channel closed before item received")
}
bj0
02/27/2018, 5:56 PMJoe
02/27/2018, 6:28 PMconsume
will pop the element out of the queue, right?Joe
02/27/2018, 6:28 PMbj0
02/27/2018, 6:33 PMbj0
02/27/2018, 6:33 PMJoe
02/27/2018, 6:51 PM