Skip to content

Instantly share code, notes, and snippets.

@rueian
Last active February 6, 2022 11:34
Show Gist options
  • Save rueian/95330036253b9f12b8c9b638222915a4 to your computer and use it in GitHub Desktop.
Save rueian/95330036253b9f12b8c9b638222915a4 to your computer and use it in GitHub Desktop.
func (r *ring) ReplyToNextRequest(resp response) {
r.read2++
s := &r.slots[r.read2&1023]
if atomic.LoadUint32(&s.mark) != 3 {
panic("out-of-band response should not be passed in")
}
s.ch <- resp // this should be a non-buffered channel
atomic.StoreUint32(&s.mark, 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment