diff options
author | Asdine El Hrychy <asdine.elhrychy@gmail.com> | 2016-03-22 15:51:53 +0100 |
---|---|---|
committer | Asdine El Hrychy <asdine.elhrychy@gmail.com> | 2016-03-22 15:51:53 +0100 |
commit | 8192480115db2ffd2bc60e3c5bcc58174303fbce (patch) | |
tree | a878750866be52455aa6290388b04ff720e98b45 /bolt_unix.go | |
parent | Update README.md (diff) | |
parent | v1.2.0 (diff) | |
download | dedo-8192480115db2ffd2bc60e3c5bcc58174303fbce.tar.gz dedo-8192480115db2ffd2bc60e3c5bcc58174303fbce.tar.xz |
Merge remote-tracking branch 'boltdb/master' into project-list
# Conflicts:
# README.md
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. |