flock

Thread-safe file locking library in Go (originally github.com/theckman/go-flock)

Github星跟蹤圖

flock

TravisCI Build Status
GoDoc
License
Go Report Card

flock implements a thread-safe sync.Locker interface for file locking. It also
includes a non-blocking TryLock() function to allow locking without blocking execution.

License

flock is released under the BSD 3-Clause License. See the LICENSE file for more details.

Go Compatibility

This package makes use of the context package that was introduced in Go 1.7. As such, this
package has an implicit dependency on Go 1.7+.

Installation

go get -u github.com/gofrs/flock

Usage

import "github.com/gofrs/flock"

fileLock := flock.New("/var/lock/go-lock.lock")

locked, err := fileLock.TryLock()

if err != nil {
	// handle locking error
}

if locked {
	// do work
	fileLock.Unlock()
}

For more detailed usage information take a look at the package API docs on
GoDoc.

主要指標

概覽
名稱與所有者neo-ai/neo-ai-dlr
主編程語言C++
編程語言Go (語言數: 10)
平台
許可證Apache License 2.0
所有者活动
創建於2018-12-14 22:25:31
推送於2023-05-18 19:06:52
最后一次提交
發布數12
最新版本名稱v1.13.0 (發布於 )
第一版名稱v1.0 (發布於 2019-03-21 15:41:45)
用户参与
星數492
關注者數34
派生數106
提交數298
已啟用問題?
問題數81
打開的問題數46
拉請求數313
打開的拉請求數0
關閉的拉請求數61
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?