mutex

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReMutex

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

ReMutex doc @Struct ReMutex @Summary Reentrant mutex

func (*ReMutex) Lock

func (slf *ReMutex) Lock()

Lock doc @Method Lock @Summary locking

func (*ReMutex) Unlock

func (slf *ReMutex) Unlock()

Unlock doc @Method Unlock doc : unlocking

func (*ReMutex) Width

func (slf *ReMutex) Width(m *sync.Mutex)

Width doc @Method Width @Summary Sync lock association reentrant lock @Param (*sync.Mutex) mutex object

type ReSpinLock

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

ReSpinLock doc @Struct ReSpinLock @Summary Re-entrant spin lock

func (*ReSpinLock) Lock

func (slf *ReSpinLock) Lock()

Lock doc @Method Lock @Summary locking

func (*ReSpinLock) Trylock

func (slf *ReSpinLock) Trylock() bool

Trylock doc @Method Trylock doc : Try to lock if you fail to get the lock return failure will not try again @Return (bool)

func (*ReSpinLock) Unlock

func (slf *ReSpinLock) Unlock()

Unlock doc @Method Unlock @Summary unlocking

func (*ReSpinLock) Width

func (slf *ReSpinLock) Width(m *SpinLock)

Width doc @Method Width doc : Spinlock association reentrant spin lock @Param (*SpinLock) width spinlock object

type RedisMethodDo

type RedisMethodDo func(commandName string, args ...interface{}) (interface{}, error)

RedisMethodDo doc @type (func(commandName string, args ...interface{}) (interface{}, error))

type RedisMutex

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

RedisMutex doc @Summary redis mutex object @Member (string) resource @Member (string) token @Member (int) timeout

func TryRedisLock

func TryRedisLock(doFun RedisMethodDo,
	resouse string,
	token string,
	timeout int) (m *RedisMutex, ok bool, err error)

TryRedisLock Try to acquire a lock @Summary Try to acquire a locking @Param (RedisMethodDo) redis do function @Param (string) lock object(key/name) @Param (string) lock token @Param (int) lock timeout millsec @Return (*RedisMutex) redis mutex object @Return (bool) redis lock is success @Return (error) redis lock fail error informat

func TryRedisLockWithTimeOut

func TryRedisLockWithTimeOut(doFun RedisMethodDo,
	resouse string,
	token string,
	timeout int) (m *RedisMutex, ok bool, err error)

TryRedisLockWithTimeOut doc @Summary Try to acquire the lock and set the lock timeout @Param (RedisMethodDo) redis do function @Param (string) lock object(key/name) @Param (string) lock token @Param (int) lock timeout millsec @Return (*RedisMutex) redis mutex object @Return (bool) redis lock is success @Return (error) redis lock fail error informat

func (*RedisMutex) AddTimeOut

func (slf *RedisMutex) AddTimeOut(exTime int64) (ok bool, err error)

AddTimeOut doc @Summary rest/append lock timeout time @Param (int64) setting/append time @Return (bool) @reutrn (error)

func (*RedisMutex) Unlock

func (slf *RedisMutex) Unlock() (err error)

Unlock doc @Method Unlock @Summary unlocking @Return (error) unlock fail returns error informat

type SpinLock

type SpinLock struct {
	Deplay time.Duration
	Check  int
	// contains filtered or unexported fields
}

SpinLock doc @Struct SpinLick @Summary spin lock @Member (uint32)

func (*SpinLock) Lock

func (slf *SpinLock) Lock()

Lock doc @Method Lock @Summary locking

func (*SpinLock) Trylock

func (slf *SpinLock) Trylock() bool

Trylock doc @Method Trylock @Summary try lock if unlock return false @Return (bool)

func (*SpinLock) Unlock

func (slf *SpinLock) Unlock()

Unlock doc @Method Unlock @Summary unlocking

Jump to

Keyboard shortcuts

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