example

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start()

Start 经常会有这样的场景,当信息收集完成,通知下游开始计算数据。

func StartConcurrency

func StartConcurrency()

StartConcurrency 并发控制 在凌晨的时候对内或者对外拉取数据,但是如果不对并发请求加以控制,往往会导致 groutine 泛滥,进而打满 CPU 资源。往往不能控制的东西意味着不好的事情将要发生。对于我们来说,可以通过 channel 来控制并发数。

func StartMutex

func StartMutex()

StartMutex .互斥锁 我们也可以通过 channel 实现一个小小的互斥锁。通过设置一个缓冲区为1的通道,如果成功地往通道发送数据,说明拿到锁,否则锁被别人拿了,等待他人解锁。

func StartOutTime

func StartOutTime()

Start 执行任务超时: 我们在做任务处理的时候,并不能保证任务的处理时间,通常会加上一些超时控制做异常的处理。

func StartProduct

func StartProduct()

生产消费模型: 生产者只需要关注生产,而不用去理会消费者的消费行为,更不用关心消费者是否执行完毕。而消费者只关心消费任务,而不需要关注如何生产。

func StartTransmission

func StartTransmission()

Types

type Mutex

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

Jump to

Keyboard shortcuts

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