summaryrefslogtreecommitdiffhomepage
path: root/pkg/amutex/amutex.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/amutex/amutex.go')
-rw-r--r--pkg/amutex/amutex.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/amutex/amutex.go b/pkg/amutex/amutex.go
index 85e819304..4f7759b87 100644
--- a/pkg/amutex/amutex.go
+++ b/pkg/amutex/amutex.go
@@ -33,6 +33,9 @@ type Sleeper interface {
// SleepFinish is called by AbortableMutex.Lock() once a contended mutex
// is acquired or the wait is aborted.
SleepFinish(success bool)
+
+ // Interrupted returns true if the wait is aborted.
+ Interrupted() bool
}
// NoopSleeper is a stateless no-op implementation of Sleeper for anonymous
@@ -47,6 +50,9 @@ func (NoopSleeper) SleepStart() <-chan struct{} {
// SleepFinish implements Sleeper.SleepFinish.
func (NoopSleeper) SleepFinish(success bool) {}
+// Interrupted implements Sleeper.Interrupted.
+func (NoopSleeper) Interrupted() bool { return false }
+
// AbortableMutex is an abortable mutex. It allows Lock() to be aborted while it
// waits to acquire the mutex.
type AbortableMutex struct {