flock

package
v0.0.0-...-b47ea92 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MIT Imports: 2 Imported by: 1

README

Read-write mutex lock across process

GoDoc

Support Linux, Mac, Window.

Documentation

Overview

Package flock provides read-write mutex locks across process for Linux, Mac and Windows. RWMutex methods shall panic if they are misused.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RWMutex

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

RWMutex is equivalent to sync.RWMutex, but synchronizes across processes.

func New

func New(filename string) (*RWMutex, error)

New create a new instance of multi-process rwmutex.

func (*RWMutex) Lock

func (rw *RWMutex) Lock()

Lock locks rw. If the lock is already in use, the calling goroutine blocks until the mutex is available.

func (*RWMutex) RLock

func (rw *RWMutex) RLock()

RLock locks rw for reading. It should not be used for recursive read locking; a blocked Lock call excludes new readers from acquiring the lock.

func (*RWMutex) RUnlock

func (rw *RWMutex) RUnlock()

RUnlock undo a single RLock call; it does not affect other simultaneous readers.

func (*RWMutex) Unlock

func (rw *RWMutex) Unlock()

Unlock unlocks rw. It is a run-time error if rw is not locked on entry to Unlock.

Jump to

Keyboard shortcuts

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