Skip to content

Commit afc4a84

Browse files
doc: describe the semantics of sealed
Document the `MessageSink` for more clarity.
1 parent a31aec7 commit afc4a84

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/common/message_sink.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ type MessageSink[SenderType comparable, MessageType any] struct {
1616
// The message sink to which the messages are sent.
1717
messageSink chan<- Message[SenderType, MessageType]
1818
// Atomic variable that indicates whether the message sink is sealed.
19-
// This is used to prevent sending messages to a sealed message sink.
20-
// The variable is atomic because it may be accessed from multiple goroutines.
19+
// Basically it means that **the current sender** (but not other senders)
20+
// won't be able to send any more messages to the message sink. The difference
21+
// between this and the channel being closed is that the closed channel is not
22+
// available for writing for all senders.
2123
sealed atomic.Bool
2224
}
2325

0 commit comments

Comments
 (0)