Skip to content

Commit

Permalink
API BREAK: Drop Lockfile.Locked
Browse files Browse the repository at this point in the history
It is fundamentally incorrect, and no users are remaining.

Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Oct 21, 2022
1 parent 8e27034 commit d4462aa
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 14 deletions.
3 changes: 0 additions & 3 deletions pkg/lockfile/lockfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ type Locker interface {
// IsReadWrite() checks if the lock file is read-write
IsReadWrite() bool

// Locked() checks if lock is locked for writing by a thread in this process
Locked() bool

// AssertLocked() can be used by callers that _know_ that they hold the lock (for reading or writing), for sanity checking.
// It might do nothing at all, or it may panic if the caller is not the owner of this lock.
AssertLocked()
Expand Down
7 changes: 0 additions & 7 deletions pkg/lockfile/lockfile_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,6 @@ func (l *lockfile) Unlock() {
l.stateMutex.Unlock()
}

// Locked checks if lockfile is locked for writing by a thread in this process.
func (l *lockfile) Locked() bool {
l.stateMutex.Lock()
defer l.stateMutex.Unlock()
return l.locked && (l.locktype == unix.F_WRLCK)
}

func (l *lockfile) AssertLocked() {
// DO NOT provide a variant that returns the value of l.locked.
//
Expand Down
4 changes: 0 additions & 4 deletions pkg/lockfile/lockfile_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ func (l *lockfile) Unlock() {
l.mu.Unlock()
}

func (l *lockfile) Locked() bool {
return l.locked
}

func (l *lockfile) AssertLocked() {
// DO NOT provide a variant that returns the value of l.locked.
//
Expand Down

0 comments on commit d4462aa

Please sign in to comment.