Skip to content

Instantly share code, notes, and snippets.

@rueian
Created February 20, 2022 12:31
Show Gist options
  • Save rueian/08580c14ff88b9e8b18207c80e56c1c1 to your computer and use it in GitHub Desktop.
Save rueian/08580c14ff88b9e8b18207c80e56c1c1 to your computer and use it in GitHub Desktop.
type slot struct {
cond sync.Cond
mark uint32
req request
ch chan response
}
func newRing() *ring {
r := &ring{}
for i := range r.slots {
r.slots[i] = slot{ch: make(chan response, 0)}
r.slots[i].cond.L = &sync.Mutex{}
}
return r
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment