diff options
Diffstat (limited to 'vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go')
-rw-r--r-- | vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go b/vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go new file mode 100644 index 0000000000..0eda3bd300 --- /dev/null +++ b/vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go @@ -0,0 +1,21 @@ +// +build !windows + +package osfs + +import ( + "syscall" +) + +func (f *file) Lock() error { + f.m.Lock() + defer f.m.Unlock() + + return syscall.Flock(int(f.File.Fd()), syscall.LOCK_EX) +} + +func (f *file) Unlock() error { + f.m.Lock() + defer f.m.Unlock() + + return syscall.Flock(int(f.File.Fd()), syscall.LOCK_UN) +} |