Closed molon closed 9 months ago
https://github.com/smallnest/chanx/blob/0aaad016beec0e4b4b7bd571b0960e337cd48f2e/unbounded_chan.go#L54-L66
Why not Peek first and then Pop? There is a possibility that out did not receive this Pop data because ctx.Done was triggered first after Pop from buf.
Peek
Pop
out
Pop data
ctx.Done
Pop from buf
Of course, after thinking about it, since ctx.Done, it seems not very necessary.
This is drain, if users have selected ctx.Done, then drain is finished
drain
https://github.com/smallnest/chanx/blob/0aaad016beec0e4b4b7bd571b0960e337cd48f2e/unbounded_chan.go#L54-L66
Why not
Peek
first and thenPop
? There is a possibility thatout
did not receive thisPop data
becausectx.Done
was triggered first afterPop from buf
.