diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dedo.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/dedo.go b/src/dedo.go index ead56b8..8e37154 100644 --- a/src/dedo.go +++ b/src/dedo.go @@ -587,19 +587,12 @@ func fdatasync(db *DB) error { return db.file.Sync() } - // flock acquires an advisory lock on a file descriptor. func flock(db *DB) error { - const exclusive = true // FIXME: allow multiple processes to cooperate + const lockFlags = syscall.LOCK_EX | syscall.LOCK_NB for { - flag := syscall.LOCK_SH - if exclusive { - flag = syscall.LOCK_EX - } - - // Otherwise attempt to obtain an exclusive lock. - err := syscall.Flock(int(db.file.Fd()), flag|syscall.LOCK_NB) + err := syscall.Flock(int(db.file.Fd()), lockFlags) if err == nil { return nil } else if err != syscall.EWOULDBLOCK { |