gf: github.com/johng-cn/gf/g/os/gflock Index | Files

package gflock

import "github.com/johng-cn/gf/g/os/gflock"

Package gflock implements a thread-safe sync.Locker interface for file locking.

文件锁.

Index

Package Files

gflock.go

type Locker Uses

type Locker struct {
    // contains filtered or unexported fields
}

文件锁

func New Uses

func New(file string) *Locker

创建文件锁

func (*Locker) IsLocked Uses

func (l *Locker) IsLocked() bool

当前文件锁是否处于锁定状态(Lock)

func (*Locker) Lock Uses

func (l *Locker) Lock()

func (*Locker) Path Uses

func (l *Locker) Path() string

func (*Locker) RLock Uses

func (l *Locker) RLock()

func (*Locker) RUnlock Uses

func (l *Locker) RUnlock()

func (*Locker) TryLock Uses

func (l *Locker) TryLock() bool

尝试Lock文件,如果失败立即返回

func (*Locker) TryRLock Uses

func (l *Locker) TryRLock() bool

尝试RLock文件,如果失败立即返回

func (*Locker) UnLock Uses

func (l *Locker) UnLock()

Package gflock imports 3 packages (graph). Updated 2019-02-11. Refresh now. Tools for package owners.