Skip to content

Commit

Permalink
libflac.go: don't pass mutexes by value.
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Turner committed Jun 23, 2016
1 parent 8a4f0c0 commit d80dbc5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libflac.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@ type encoderPtrMap struct {
ptrs map[uintptr]*Encoder
}

func (m encoderPtrMap) get(e *C.FLAC__StreamEncoder) *Encoder {
func (m *encoderPtrMap) get(e *C.FLAC__StreamEncoder) *Encoder {
ptr := uintptr(unsafe.Pointer(e))
m.RLock()
defer m.RUnlock()
return m.ptrs[ptr]
}

func (m encoderPtrMap) add(e *Encoder) {
func (m *encoderPtrMap) add(e *Encoder) {
m.Lock()
defer m.Unlock()
m.ptrs[uintptr(unsafe.Pointer(e.e))] = e
}

func (m encoderPtrMap) del(e *Encoder) {
func (m *encoderPtrMap) del(e *Encoder) {
m.Lock()
defer m.Unlock()
delete(m.ptrs, uintptr(unsafe.Pointer(e.e)))
Expand Down

0 comments on commit d80dbc5

Please sign in to comment.