go语言的chan
chan是一个FIFO队列,chan分成两种类型同步和异步同步的chan完成发送者和接受者之间手递手传递元素的过程,必须要求对方的存在才能完成一次发送或接受异步的chan发送和接受都是基于chan的缓存,但当缓存队列填满后,发送者就会进入发送队列, 当缓存队列为空时,接受者就会接入等待队列。 chan的数据结构: struct Hchan { uintgo qcount; // total data in the q uintgo dataqsiz; // size of the circular q uint16 elemsize; uint16 pad; // ensures proper alignment of the buffer that follows Hchan in mem...阅读全文