chanlock

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

chan实现trylock乐观锁

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChanLock

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

ChanLock chan lock

func NewChanLock

func NewChanLock() *ChanLock

NewChanLock 实例化一个通道空结构体锁对象

func (*ChanLock) Lock

func (l *ChanLock) Lock()

Lock 通道枷锁

func (*ChanLock) TryLock

func (l *ChanLock) TryLock() bool

TryLock 乐观锁实现

func (*ChanLock) TryLockTimeout

func (l *ChanLock) TryLockTimeout(timeout time.Duration) bool

TryLockTimeout 指定时间内的乐观锁

func (*ChanLock) Unlock

func (l *ChanLock) Unlock()

Unlock实现通道解锁

Jump to

Keyboard shortcuts

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