smokeybear
smokeybear

Reputation: 43

How big is the channel queue in Golang?

In Golang unbuffered channel is just a FIFO queue. How many items can be in that queue at any time? Is there a limit?

Upvotes: 2

Views: 3109

Answers (1)

andybalholm
andybalholm

Reputation: 16120

The number of items that can be in the channel itself is zero, because it is unbuffered. But there is no limit on the number of goroutines than can be waiting to send on the channel. (When a goroutine tries to send on a channel with no buffer or a full buffer, it blocks until another goroutine is ready to receive from the channel.)

Upvotes: 4

Related Questions