0%

Go_Learning_Fundamental_Concurrency_Channel

Channel to help organize and control the communication between the different processes, allowing us to avoid a race condition bug.

Go语言的并发模型是CSP(Communicating Sequential Processes),提倡通过通信共享内存而不是通过共享内存而实现通信。

Definition

Channel is a type of GO FUNDAMENTAL DATA STRUCTURE, that use to communicate with different Goroutine;

Usage

channel data structure is refs type;

Init

1
2
3
4
5
// 1.var
var ch chan int
ch = make(chan int)
// 2. make
ch := make(chan int)