flock

package
v5.3.3-pre13 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCompleted

func IsCompleted(file *os.File, start time.Time) bool

IsCompleted 等待文件有数据且已写完 费时操作 放在子线程中执行 @param file 文件 @param start 需要传入 time.Now.Local(),用于兼容遍历的情况 @return true:已写完 false:外部程序阻塞或者文件不存在

func Lock

func Lock(f *os.File) error

Lock 共享锁(支持多读),非阻塞模式,获取失败直接返回错误

func LockBlock

func LockBlock(f *os.File) error

LockBlock 共享锁,阻塞模式,获取不到时阻塞等待直至成功

func LockEx

func LockEx(f *os.File) error

LockEx 独占锁(独占读和写),非阻塞模式,获取失败直接返回错误

func LockExBlock

func LockExBlock(f *os.File) error

LockExBlock 独占锁,阻塞模式,获取不到时阻塞等待直至成功

func Unlock

func Unlock(f *os.File) error

Unlock 解锁

func UnlockAndClose

func UnlockAndClose(f *os.File) error

UnlockAndClose 解锁并关闭文件

Types

This section is empty.

Jump to

Keyboard shortcuts

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