David Stibbe
05/27/2022, 12:13 AMfor( message in myChannel){ ... }
loop. I can see, via logging, that the events are being send and I see that they are read in the for loop. However, all except for one of the sending coroutines do not continue and keep being stuck in the suspended state.
Any idea what could cause this ?
Adding a buffer to the channel seems to help, but I would like to know what causes my issue ?Zach Klippenstein (he/him) [MOD]
05/27/2022, 12:14 AMDavid Stibbe
05/27/2022, 12:15 AMChannel()
Zach Klippenstein (he/him) [MOD]
05/27/2022, 12:18 AMThefactory function is used to create channels of different kinds depending on the value of theChannel(capacity)
integer:capacity
• When(bold added) Inis 0 — it creates a rendezvous channel. This channel does not have any buffer at all. An element is transferred from the sender to the receiver only when send and receive invocations meet in time (rendezvous), so send suspends until another coroutine invokes receive, and receive suspends until another coroutine invokes send.capacity
RENDEZVOUS
mode, “Send suspends until another coroutine invokes receive”
And if you look at the docs for the Channel()
function, you’ll see the default capacity is RENDEZVOUS
.David Stibbe
05/27/2022, 12:18 AMDavid Stibbe
05/27/2022, 12:19 AMDavid Stibbe
05/27/2022, 12:19 AMZach Klippenstein (he/him) [MOD]
05/27/2022, 12:19 AMDavid Stibbe
05/27/2022, 12:20 AMZach Klippenstein (he/him) [MOD]
05/27/2022, 12:22 AMDavid Stibbe
05/27/2022, 12:27 AMJoffrey
05/27/2022, 6:19 AMDavid Stibbe
05/27/2022, 9:19 AMstreetsofboston
05/27/2022, 12:57 PMDavid Stibbe
05/27/2022, 12:58 PMDavid Stibbe
06/06/2022, 9:06 PMtestApplication
function.David Stibbe
06/06/2022, 9:06 PMDavid Stibbe
06/06/2022, 9:07 PMval client = createClient {
engine { CIO }
install(WebSockets)
}
David Stibbe
06/06/2022, 9:07 PM