lock

package
v0.0.0-...-3dc5271 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lock

type Lock struct {
	Type   string `gorm:"unique_index:idx_lock_tol"` //object type
	ObjID  uint   `gorm:"unique_index:idx_lock_tol"` //object id
	LockID uint   `gorm:"unique_index:idx_lock_tol"` //lock id
}

Lock for mutex

func GetLock

func GetLock(objType string, objID uint) *Lock

func (*Lock) TryLock

func (p *Lock) TryLock() bool

TryLock return true if the lock has been acquired

func (*Lock) Unlock

func (p *Lock) Unlock()

Unlock release the lock.Do nothing if no lock

Jump to

Keyboard shortcuts

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