Documentation ¶
Overview ¶
Package amutex provides the implementation of an abortable mutex. It allows the Lock() function to be canceled while it waits to acquire the mutex.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AbortableMutex ¶
type AbortableMutex struct {
// contains filtered or unexported fields
}
AbortableMutex is an abortable mutex. It allows Lock() to be aborted while it waits to acquire the mutex.
func (*AbortableMutex) Lock ¶
func (m *AbortableMutex) Lock(s Sleeper) bool
Lock attempts to acquire the mutex, returning true on success. If something is written to the "c" while Lock waits, the wait is aborted and false is returned instead.
type NoopSleeper ¶
NoopSleeper is a stateless no-op implementation of Sleeper for anonymous embedding in other types that do not support cancelation.
type Sleeper ¶
type Sleeper = context.ChannelSleeper
Sleeper must be implemented by users of the abortable mutex to allow for cancellation of waits.
Click to show internal directories.
Click to hide internal directories.