Skip to content

Commit

Permalink
Merge pull request #21 from virtuald/explicit-close
Browse files Browse the repository at this point in the history
Add an explicit Close function

Signed-off-by: Tim Heckman <t@heckman.io>
  • Loading branch information
theckman committed Sep 15, 2018
2 parents dd99ba2 + 37b0e02 commit c938b7e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions flock.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ func NewFlock(path string) *Flock {
return &Flock{path: path}
}

// Close is equivalent to calling Unlock.
//
// This will release the lock and close the underlying file descriptor.
// It will not remove the file from disk, that's up to your application.
func (f *Flock) Close() error {
return f.Unlock()
}

// Path is a function to return the path as provided in NewFlock().
func (f *Flock) Path() string {
return f.path
Expand Down

0 comments on commit c938b7e

Please sign in to comment.