syncq

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncQueue

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

SyncQueue Synchronous FIFO queue

func NewSyncQueue

func NewSyncQueue() *SyncQueue

NewSyncQueue Create a new SyncQueue

func (*SyncQueue) Close

func (q *SyncQueue) Close()

Close SyncQueue

After close, Pop will return nil without block, and TryPop will return v=nil, ok=True

func (*SyncQueue) Len

func (q *SyncQueue) Len() (l int)

Len Get the length of SyncQueue

func (*SyncQueue) Pop

func (q *SyncQueue) Pop() (v interface{})

Pop an item from SyncQueue, will block if SyncQueue is empty

func (*SyncQueue) Push

func (q *SyncQueue) Push(v interface{})

Push an item to SyncQueue. Always returns immediately without blocking

func (*SyncQueue) TryPop

func (q *SyncQueue) TryPop() (v interface{}, ok bool)

TryPop Try to pop an item from SyncQueue, will return immediately with bool=false if SyncQueue is empty

Jump to

Keyboard shortcuts

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