filelock

package
v0.0.0-...-d66ce5c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadLock  lockType = syscall.LOCK_SH
	WriteLock lockType = syscall.LOCK_EX
)

Variables

View Source
var ErrFileLock = errors.New("file is lock")

Functions

func Lock

func Lock(f *os.File) error

排它锁锁住文件

func LockOpenFile

func LockOpenFile(name string, flag int, perm os.FileMode, lt lockType) (*file, error)

打开文件并带上锁

func RLock

func RLock(f *os.File) error

共享锁锁住文件

func Unlock

func Unlock(f *os.File) error

释放文件锁

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL