File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ type bufferedBus struct {
33
33
subs map [uint64 ]* Subscription
34
34
// events is a mapping of event names to subscriber ids.
35
35
events map [Name ]map [uint64 ]struct {}
36
- // commandChannel manages all commands sent to this simpleChannel .
36
+ // commandChannel manages all commands sent to the bufferedBus .
37
37
//
38
38
// It is important that all stuff gets sent through this single channel to ensure
39
39
// that the order of operations is preserved.
@@ -90,10 +90,9 @@ func (b *bufferedBus) Unsubscribe(sub *Subscription) {
90
90
}
91
91
92
92
func (b * bufferedBus ) Close () {
93
- if b .isClosed .Load ( ) {
93
+ if ! b .isClosed .CompareAndSwap ( false , true ) {
94
94
return
95
95
}
96
- b .isClosed .Store (true )
97
96
b .commandChannel <- closeCommand {}
98
97
// Wait for the close command to be handled, in order, before returning
99
98
<- b .hasClosedChan
You can’t perform that action at this time.
0 commit comments