src

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: BSD-2-Clause Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoOnce

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

func New added in v1.0.3

func New() *DoOnce

func (*DoOnce) Release

func (u *DoOnce) Release(RequestTag interface{})

RequestTag 请求标识 用于标识同一个资源 获得执行权限的线程需要在执行完业务逻辑后调用该方法通知其他处于阻塞状态的线程

func (*DoOnce) Req

func (u *DoOnce) Req(RequestTag interface{}) bool

RequestTag 请求标识 用于标识同一个资源 同一时刻只有一个请求能获取执行权限,获得执行权限的线程接下来需要执行具体的业务逻辑, 完成后调用release方法通知其他线程,操作已完成,获取资源即可 其他请求接下来需要调用wait方法

func (*DoOnce) Wait

func (u *DoOnce) Wait(RequestTag interface{})

RequestTag 请求标识 用于标识同一个资源 调用wait方法将处于阻塞状态,直到获得执行权限的线程处理完具体的业务逻辑,调用release方法来通知其他线程资源ok了

Jump to

Keyboard shortcuts

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