File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,9 @@ import (
2424
2525// Gate implements a gated function callback registration with comparable conditions.
2626type Gate [T comparable ] struct {
27- mux sync.RWMutex
28- conditions map [T ]bool
29- fns []gated [T ]
27+ mux sync.RWMutex
28+ satisfied map [T ]bool
29+ fns []gated [T ]
3030}
3131
3232// gated is an internal tracking resource.
@@ -55,16 +55,16 @@ func (g *Gate[T]) Register(fn func(), depends ...T) {
5555func (g * Gate [T ]) Set (condition T , value bool ) bool {
5656 g .mux .Lock ()
5757
58- if g .conditions == nil {
59- g .conditions = make (map [T ]bool )
58+ if g .satisfied == nil {
59+ g .satisfied = make (map [T ]bool )
6060 }
6161
62- old , found := g .conditions [condition ]
62+ old , found := g .satisfied [condition ]
6363
6464 updated := false
6565 if ! found || old != value {
6666 updated = true
67- g .conditions [condition ] = value
67+ g .satisfied [condition ] = value
6868 }
6969 // process() would also like to lock the mux, so we must unlock here directly and not use defer.
7070 g .mux .Unlock ()
@@ -85,7 +85,7 @@ func (g *Gate[T]) process() {
8585 release := true
8686
8787 for _ , dep := range g .fns [i ].depends {
88- if ! g .conditions [dep ] {
88+ if ! g .satisfied [dep ] {
8989 release = false
9090 }
9191 }
You can’t perform that action at this time.
0 commit comments