gflock

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

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

文件锁.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

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

文件锁

func New

func New(file string) *Locker

创建文件锁

func (*Locker) IsLocked

func (l *Locker) IsLocked() bool

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

func (*Locker) Lock

func (l *Locker) Lock()

func (*Locker) Path

func (l *Locker) Path() string

func (*Locker) RLock

func (l *Locker) RLock()

func (*Locker) RUnlock

func (l *Locker) RUnlock()

func (*Locker) TryLock

func (l *Locker) TryLock() bool

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

func (*Locker) TryRLock

func (l *Locker) TryRLock() bool

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

func (*Locker) UnLock

func (l *Locker) UnLock()

Jump to

Keyboard shortcuts

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