-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathsync_disable_go118.go
More file actions
55 lines (41 loc) · 894 Bytes
/
Copy pathsync_disable_go118.go
File metadata and controls
55 lines (41 loc) · 894 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//go:build deadlock_disable && go1.18
package deadlock
import "sync"
// StandardMutex wraps sync.Mutex with no deadlock detection
type StandardMutex struct {
mu sync.Mutex
}
func (m *StandardMutex) Lock() {
m.mu.Lock()
}
func (m *StandardMutex) Unlock() {
m.mu.Unlock()
}
func (m *StandardMutex) TryLock() bool {
return m.mu.TryLock()
}
// StandardRWMutex wraps sync.RWMutex with no deadlock detection
type StandardRWMutex struct {
mu sync.RWMutex
}
func (m *StandardRWMutex) Lock() {
m.mu.Lock()
}
func (m *StandardRWMutex) Unlock() {
m.mu.Unlock()
}
func (m *StandardRWMutex) RLock() {
m.mu.RLock()
}
func (m *StandardRWMutex) RUnlock() {
m.mu.RUnlock()
}
func (m *StandardRWMutex) TryLock() bool {
return m.mu.TryLock()
}
func (m *StandardRWMutex) TryRLock() bool {
return m.mu.TryRLock()
}
func (m *StandardRWMutex) RLocker() sync.Locker {
return m.mu.RLocker()
}