-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmutex.go
More file actions
30 lines (22 loc) · 818 Bytes
/
Copy pathmutex.go
File metadata and controls
30 lines (22 loc) · 818 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
package hot
// rwMutex defines the interface for read-write mutex operations.
// This interface allows for different mutex implementations, including no-op mocks.
type rwMutex interface {
Lock()
Unlock()
RLock()
RUnlock()
}
// mutexMock is a no-op implementation of rwMutex used when locking is disabled.
// It provides zero-cost mutex operations for single-threaded usage.
type mutexMock struct{}
// Ensure mutexMock implements rwMutex interface.
var _ rwMutex = (*mutexMock)(nil)
// Lock is a no-op operation for the mock mutex.
func (f mutexMock) Lock() {}
// Unlock is a no-op operation for the mock mutex.
func (f mutexMock) Unlock() {}
// RLock is a no-op operation for the mock mutex.
func (f mutexMock) RLock() {}
// RUnlock is a no-op operation for the mock mutex.
func (f mutexMock) RUnlock() {}