summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/internal/dotlk/dotlk_other.go
blob: 5399a5f8a140453a767b64724b857b5476b998c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//go:build !unix

package dotlk

import "os"

// TryLock returns nil if it acquired the lock,
// fs.ErrExist if another process has the lock.
func TryLock(name string) error {
	f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666)
	f.Close()
	return err
}