chnlworkq

package
v4.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: BSD-3-Clause, BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

chnlworkq package makes work queues based on channels using a double linked list as internal storage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(reqBufSize, workBufSize int, procReq procReq, procWork procWork, quit chan struct{}, wg *sync.WaitGroup) (chan interface{}, chan interface{}, error)

New make a work queue. It creates a channel that can be used to submit requests and another channel from which queued items can be pulled out. Here internal storage (using double linked list) is used instead of allocating a fixed sized for channel buffer. The size of the queue can grow and shrink based on the contents currently in the queue. reqBufSize and workBufSize represents the buffer size of the channel. Consider the size of these to avoid goroutines going to sleep in between since items have not been pulled out from the channel. procReq is a callback function that can be used to process a request and return an object that is to be stored within the queue data structure.

Types

This section is empty.

Jump to

Keyboard shortcuts

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