queue

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package queue 队列模块 HLQueue: wlst tcp module 定制模块,内部分为高低优先级2个队列,高优先级队列可设置先进先出或先进后出,低优先级队列只能先进先出。当高优先级队列有数据时,优先读取高优先级队列的数据 Queue: 常规队列模块

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HLQueue

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

HLQueue 高低优先级队列,高优先级队列有数据时优先提取高优先级数据

func NewHLQueue

func NewHLQueue(fifo bool) *HLQueue

NewHLQueue 创建一个高低优先级队列,低优先级队列默认先进先出

fifo: 指定高优先级队列的进出方式,true-先进先出,false-先进后出

func (*HLQueue) Clear

func (q *HLQueue) Clear()

Clear 清空所有队列

func (*HLQueue) Empty

func (q *HLQueue) Empty() bool

Empty 队列是否为空

func (*HLQueue) Get

func (q *HLQueue) Get() interface{}

Get 获取数据

func (*HLQueue) Len

func (q *HLQueue) Len() int64

Len 返回队列长度,2个队列的总和

func (*HLQueue) Put

func (q *HLQueue) Put(v interface{})

Put 添加低优先级数据

func (*HLQueue) PutFront

func (q *HLQueue) PutFront(v interface{})

PutFront 添加高优先级数据

type Queue

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

Queue queue for go

func New

func New() *Queue

New get a new queue

func (*Queue) Clear

func (mq *Queue) Clear()

Clear clear queue list

func (*Queue) Empty

func (mq *Queue) Empty() bool

Empty check if empty

func (*Queue) Get

func (mq *Queue) Get() interface{}

Get get data from front

func (*Queue) GetNoDel

func (mq *Queue) GetNoDel() interface{}

GetNoDel get data from front

func (*Queue) Len

func (mq *Queue) Len() int64

Len get queue len

func (*Queue) Put

func (mq *Queue) Put(value interface{})

Put put data to the end of the queue

func (*Queue) PutFront

func (mq *Queue) PutFront(value interface{})

PutFront put data to the first of the queue

Jump to

Keyboard shortcuts

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