-
Notifications
You must be signed in to change notification settings - Fork 22
/
mutex.go
25 lines (19 loc) · 888 Bytes
/
mutex.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//go:build !mutexlog
// +build !mutexlog
package bchutil
import "sync"
// Mutex is used for non-logging mutexes and simply delegates all calls to the
// underlying sync.Mutex
type Mutex sync.Mutex
func NewMutex(_ string) Mutex { return Mutex{} }
func (m *Mutex) Lock() { (*sync.Mutex)(m).Lock() }
func (m *Mutex) Unlock() { (*sync.Mutex)(m).Unlock() }
// RWMutex is used for non-logging mutexes and simply delegates all calls to the
// underlying sync.RWMutex
type RWMutex sync.RWMutex
func NewRWMutex(_ string) RWMutex { return RWMutex{} }
func (m *RWMutex) Lock() { (*sync.RWMutex)(m).Lock() }
func (m *RWMutex) Unlock() { (*sync.RWMutex)(m).Unlock() }
func (m *RWMutex) RLock() { (*sync.RWMutex)(m).RLock() }
func (m *RWMutex) RUnlock() { (*sync.RWMutex)(m).RUnlock() }
func (m *RWMutex) RLocker() { (*sync.RWMutex)(m).RLocker() }