Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartConcurrency ¶
func StartConcurrency()
StartConcurrency 并发控制 在凌晨的时候对内或者对外拉取数据,但是如果不对并发请求加以控制,往往会导致 groutine 泛滥,进而打满 CPU 资源。往往不能控制的东西意味着不好的事情将要发生。对于我们来说,可以通过 channel 来控制并发数。
func StartMutex ¶
func StartMutex()
StartMutex .互斥锁 我们也可以通过 channel 实现一个小小的互斥锁。通过设置一个缓冲区为1的通道,如果成功地往通道发送数据,说明拿到锁,否则锁被别人拿了,等待他人解锁。
func StartProduct ¶
func StartProduct()
生产消费模型: 生产者只需要关注生产,而不用去理会消费者的消费行为,更不用关心消费者是否执行完毕。而消费者只关心消费任务,而不需要关注如何生产。
func StartTransmission ¶
func StartTransmission()
Types ¶
Click to show internal directories.
Click to hide internal directories.