Documentation ¶
Overview ¶
Package gmutex inherits and extends sync.Mutex and sync.RWMutex with more futures.
Note that, it is refracted using stdlib mutex of package sync from GoFrame version v2.5.2.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mutex ¶
Mutex is a high level Mutex, which implements more rich features for mutex.
func (*Mutex) LockFunc ¶
func (m *Mutex) LockFunc(f func())
LockFunc locks the mutex for writing with given callback function `f`. If there's a write/reading lock the mutex, it will block until the lock is released.
It releases the lock after `f` is executed.
func (*Mutex) TryLockFunc ¶
TryLockFunc tries locking the mutex for writing with given callback function `f`. it returns true immediately if success, or if there's a write/reading lock on the mutex, it returns false immediately.
It releases the lock after `f` is executed.
type RWMutex ¶
RWMutex is a high level RWMutex, which implements more rich features for mutex.
func New ¶
func New() *RWMutex
New creates and returns a new mutex. Deprecated: use Mutex or RWMutex instead.
func (*RWMutex) LockFunc ¶
func (m *RWMutex) LockFunc(f func())
LockFunc locks the mutex for writing with given callback function `f`. If there's a write/reading lock the mutex, it will block until the lock is released.
It releases the lock after `f` is executed.
func (*RWMutex) RLockFunc ¶
func (m *RWMutex) RLockFunc(f func())
RLockFunc locks the mutex for reading with given callback function `f`. If there's a writing lock the mutex, it will block until the lock is released.
It releases the lock after `f` is executed.
func (*RWMutex) TryLockFunc ¶
TryLockFunc tries locking the mutex for writing with given callback function `f`. it returns true immediately if success, or if there's a write/reading lock on the mutex, it returns false immediately.
It releases the lock after `f` is executed.
func (*RWMutex) TryRLockFunc ¶
TryRLockFunc tries locking the mutex for reading with given callback function `f`. It returns true immediately if success, or if there's a writing lock on the mutex, it returns false immediately.
It releases the lock after `f` is executed.