diff options
author | Ian Gudger <igudger@google.com> | 2020-01-21 19:23:26 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-21 19:36:12 -0800 |
commit | 6a59e7f510a7b12f8b3bd768dfe569033ef07d30 (patch) | |
tree | f3230ab8459461bff3449db656aa9ccff1a7af5e /pkg/sync/tmutex_unsafe.go | |
parent | d0e75f2bef4e16356693987db6ae6bbdce749618 (diff) |
Rename DowngradableRWMutex to RWmutex.
Also renames TMutex to Mutex.
These custom mutexes aren't any worse than the standard library versions (same
code), so having both seems redundant.
PiperOrigin-RevId: 290873587
Diffstat (limited to 'pkg/sync/tmutex_unsafe.go')
-rw-r--r-- | pkg/sync/tmutex_unsafe.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/sync/tmutex_unsafe.go b/pkg/sync/tmutex_unsafe.go index 3c32f8371..3dd15578b 100644 --- a/pkg/sync/tmutex_unsafe.go +++ b/pkg/sync/tmutex_unsafe.go @@ -17,8 +17,8 @@ import ( "unsafe" ) -// TMutex is a try lock. -type TMutex struct { +// Mutex is a try lock. +type Mutex struct { sync.Mutex } @@ -27,7 +27,7 @@ type syncMutex struct { sema uint32 } -func (m *TMutex) state() *int32 { +func (m *Mutex) state() *int32 { return &(*syncMutex)(unsafe.Pointer(&m.Mutex)).state } @@ -38,7 +38,7 @@ const ( // TryLock tries to aquire the mutex. It returns true if it succeeds and false // otherwise. TryLock does not block. -func (m *TMutex) TryLock() bool { +func (m *Mutex) TryLock() bool { if atomic.CompareAndSwapInt32(m.state(), mutexUnlocked, mutexLocked) { if RaceEnabled { RaceAcquire(unsafe.Pointer(&m.Mutex)) |