diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2016-03-10 12:43:05 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2016-03-10 12:43:05 -0700 |
commit | 0fd4c0547d204c7b1cad6db6f3adad5f2cf453e5 (patch) | |
tree | 892937cdc21a4a82d17da5961eab1afc5263b695 /bolt_unix.go | |
parent | Merge pull request #515 from benbjohnson/meta-write-to (diff) | |
parent | move to separate lock file on windows (diff) | |
download | dedo-0fd4c0547d204c7b1cad6db6f3adad5f2cf453e5.tar.gz dedo-0fd4c0547d204c7b1cad6db6f3adad5f2cf453e5.tar.xz |
Merge pull request #528 from boltdb/windows
Move to separate lock file on windows
Diffstat (limited to 'bolt_unix.go')
-rw-r--r-- | bolt_unix.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bolt_unix.go b/bolt_unix.go index 4b0723a..cad62dd 100644 --- a/bolt_unix.go +++ b/bolt_unix.go @@ -11,7 +11,7 @@ import ( ) // flock acquires an advisory lock on a file descriptor. -func flock(f *os.File, exclusive bool, timeout time.Duration) error { +func flock(db *DB, mode os.FileMode, exclusive bool, timeout time.Duration) error { var t time.Time for { // If we're beyond our timeout then return an error. @@ -27,7 +27,7 @@ func flock(f *os.File, exclusive bool, timeout time.Duration) error { } // Otherwise attempt to obtain an exclusive lock. - err := syscall.Flock(int(f.Fd()), flag|syscall.LOCK_NB) + err := syscall.Flock(int(db.file.Fd()), flag|syscall.LOCK_NB) if err == nil { return nil } else if err != syscall.EWOULDBLOCK { @@ -40,8 +40,8 @@ func flock(f *os.File, exclusive bool, timeout time.Duration) error { } // funlock releases an advisory lock on a file descriptor. -func funlock(f *os.File) error { - return syscall.Flock(int(f.Fd()), syscall.LOCK_UN) +func funlock(db *DB) error { + return syscall.Flock(int(db.file.Fd()), syscall.LOCK_UN) } // mmap memory maps a DB's data file. |