aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/src-d/go-billy.v4/osfs/os_posix.go
blob: 144cde1c18785494095c06946921a9e41f33b73b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// +build !windows

package osfs

import (
	"golang.org/x/sys/unix"
)

func (f *file) Lock() error {
	f.m.Lock()
	defer f.m.Unlock()

	return unix.Flock(int(f.File.Fd()), unix.LOCK_EX)
}

func (f *file) Unlock() error {
	f.m.Lock()
	defer f.m.Unlock()

	return unix.Flock(int(f.File.Fd()), unix.LOCK_UN)
}