4 ms·
Notably channels differ from actor mailboxes in that they have a capacity, and can block the sender. Mailboxes cannot block the sender, and they do not have a c
by Zambyte 2y ago
Notably channels differ from actor mailboxes in that they have a capacity, and can block the sender. Mailboxes cannot block the sender, and they do not have a capacity in theory.
- kbolino 2y agoThe ordinary send operation blocks if the channel is full (or has no buffer), but you can send (or receive) without ever blocking, if you can accept that the message is dropped instead. It's not the most ergonomic operation, though: var sent bool select { case channel<-message: sent = true default: sent = false }
- brynb 2y agowith that said it’s quite easy to write an equivalent- https://github.com/redwood/redwood/blob/develop/utils/mailbox.go https://github.com/redwood/redwood/blob/develop/utils/mailbo...