xticker

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

功能:计时器计数类型 说明:

功能:计时器封装 说明:[计时器计数]默认一直增加,在调用处理函数后,返回的类型,可以重置 [计时器计数]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ITickerHandler

type ITickerHandler interface {
	On_ticker(ticker_count int) TICKER_COUNT_TYPE
}

接口

type TICKER_COUNT_TYPE

type TICKER_COUNT_TYPE int
const (
	ERROR    TICKER_COUNT_TYPE = 0 //错误
	RESET    TICKER_COUNT_TYPE = 1 //重置归0
	INCREASE TICKER_COUNT_TYPE = 2 //增加
)

type Ticker

type Ticker struct {
	xservice.Service //服务基类
	// contains filtered or unexported fields
}

func NewTicker

func NewTicker(i_ticker_handler ITickerHandler, duration int) *Ticker

func (*Ticker) Service_start

func (t *Ticker) Service_start(ticker_count int) error

服务开始

func (*Ticker) Service_stop

func (t *Ticker) Service_stop() error

服务停止 必须新开goroutine来关闭 如果不新开goroutine的话,调用方可能在 _ticker_handle 中的计时器处理函数 直接调用Service_stop(),导致 同一个goroutine 一个读 stop_ch,一个写 stop_ch 形成死锁

Jump to

Keyboard shortcuts

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