It queues up. Chan
is a channel, in which messages can be queued. By comparison MVar
can instead take just one value, behaving as a variable and not as a queue.
writeChan overwrites or queues up
-
05-06-2023 - |
Frage
Following thing is stated in the RWH book:
If a
Chan
is empty,readChan
blocks until there is a value to read. ThewriteChan
function never blocks: it writes a new value into aChan
immediately.
What is not clear to me is whether a call to writeChan
will overwrite the already existing message (assuming some message isn't already read) or will it queue up the message in proper order so that the unread message isn't lost ?
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow