We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef995d4 commit ffe023cCopy full SHA for ffe023c
storage/operation/callbacks.go
@@ -3,8 +3,8 @@ package operation
3
import "sync"
4
5
type Callbacks struct {
6
- sync.Mutex // protect callbacks
7
- callbacks []func(error)
+ sync.RWMutex // protect callbacks
+ callbacks []func(error)
8
}
9
10
func (b *Callbacks) AddCallback(callback func(error)) {
@@ -15,8 +15,8 @@ func (b *Callbacks) AddCallback(callback func(error)) {
15
16
17
func (b *Callbacks) NotifyCallbacks(err error) {
18
- b.Lock()
19
- defer b.Unlock()
+ b.RLock()
+ defer b.RUnlock()
20
21
for _, callback := range b.callbacks {
22
callback(err)
0 commit comments