CodePudding user response:
Create a channel can create buffer queue or the buffer queueCreate up to queue allocates memory, in the heap allocation
Returns a pointer to the channel at last
CodePudding user response:
1. Whether the element size is smaller than 2 of 16 power, otherwise throw,2. Alignment inspection, otherwise throw,
3. The element size and capacity of the product cannot be out of scope, or panic,
4. Generate * hchan set buf,
4.1. The queue and the element size is 0, the racing detector, buf save * hchan buf is located in the address,
4.2. The pointer, hchan and data as a whole, buf data address,
4.3. Pointer, hchan and data separate, buf save data address,
5. The assignment operation, to * hchan attribute assignment, element size and element type, capacity,
6. Call lockInit empty function, the function doesn't do,
7. Return * chan,