wtimer

package
v0.0.0-...-4cd9d19 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(node *Node)

Types

type LinkedList

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

func NewLinkedList

func NewLinkedList() *LinkedList

func (LinkedList) GetHead

func (this LinkedList) GetHead() *Node

*

  • 获取表头

func (LinkedList) GetLast

func (this LinkedList) GetLast() *Node

*

  • 获取表尾

func (LinkedList) Length

func (this LinkedList) Length() uint

func (*LinkedList) PushBack

func (this *LinkedList) PushBack(node Node) *Node

type Node

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

定义节点

func (*Node) Data

func (this *Node) Data() (data interface{})

func (*Node) InsertHead

func (this *Node) InsertHead(node Node) *Node

func (*Node) Next

func (this *Node) Next() (node *Node)

func (*Node) Prev

func (this *Node) Prev() (node *Node)

func (*Node) SetData

func (this *Node) SetData(data interface{})

type Timer

type Timer struct {
	TimerMap map[string]*Node //保存待执行的计时器,方便按链表节点指针地址直接删除定时器
	// contains filtered or unexported fields
}

func NewTimer

func NewTimer(inteval time.Duration) *Timer

func (*Timer) Add

func (this *Timer) Add(inteval uint32, handler func(string, ...interface{}), args ...interface{}) string

func (*Timer) Remove

func (this *Timer) Remove(key string)

type TimerTask

type TimerTask struct {
	Key         string                       //定时器名称
	Inteval     uint32                       //时间间隔,即以插入该定时器的时间为起点,Inteval秒之后执行回调函数DoSomething()。例如进程插入该定时器的时间是2015-04-05 10:23:00,Inteval=5,则执行DoSomething()的时间就是2015-04-05 10:23:05。
	DoSomething func(string, ...interface{}) //自定义事件处理函数,需要触发的事件
	Args        []interface{}                //上述函数的输入参数
}

Jump to

Keyboard shortcuts

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