File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ func (b *basicBus) Subscribe(evtTypes interface{}, opts ...event.SubscriptionOpt
173
173
out .nodes [i ] = n
174
174
}, func (n * node ) {
175
175
if n .keepLast {
176
- l := n .last . Load ()
176
+ l := n .last
177
177
if l == nil {
178
178
return
179
179
}
@@ -223,15 +223,15 @@ func (b *basicBus) Emitter(evtType interface{}, opts ...event.EmitterOpt) (e eve
223
223
224
224
type node struct {
225
225
// Note: make sure to NEVER lock basicBus.lk when this lock is held
226
- lk sync.RWMutex
226
+ lk sync.Mutex
227
227
228
228
typ reflect.Type
229
229
230
230
// emitter ref count
231
231
nEmitters int32
232
232
233
233
keepLast bool
234
- last atomic. Value
234
+ last interface {}
235
235
236
236
sinks []chan interface {}
237
237
}
@@ -248,13 +248,13 @@ func (n *node) emit(event interface{}) {
248
248
panic (fmt .Sprintf ("Emit called with wrong type. expected: %s, got: %s" , n .typ , typ ))
249
249
}
250
250
251
- n .lk .RLock ()
251
+ n .lk .Lock ()
252
252
if n .keepLast {
253
- n .last . Store ( event )
253
+ n .last = event
254
254
}
255
255
256
256
for _ , ch := range n .sinks {
257
257
ch <- event
258
258
}
259
- n .lk .RUnlock ()
259
+ n .lk .Unlock ()
260
260
}
You can’t perform that action at this time.
0 commit comments