pc

package
v0.0.0-...-6dbb570 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

生产者,消费者模型 参考源码:https://github.com/qmhball/pc/blob/master/pc.go 实例说明:https://blog.csdn.net/qmhball/article/details/107234965 这个模型中,生产者一次性产生多份数据,由指定数量的消费者逐个完成,完成后关闭 这个模型中,无法不间断的产生数据给多个消费者完成,需要一次性产生

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	ConsumerNumber int
	ChannelLength  int
	Tasks          chan interface{}
	Consumer       func(interface{})
	Producer       func(chan<- interface{})
	// contains filtered or unexported fields
}

func NewPool

func NewPool(channelLength int, consumerNumber int, produceFunc func(chan<- interface{}), consumeFunc func(interface{})) *Pool

func (*Pool) Run

func (p *Pool) Run()

Jump to

Keyboard shortcuts

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