Grokking Concurrency in Go
Vote

0% completed

​

The Select Statement

Suppose a program asks two copies of the same service for one page, a primary and a mirror, and it needs only the answer that arrives first. Each request runs in its own goroutine and sends its page on its own channel. Which of the two channels should main receive from?

Neither choice works on its own. If main receives from the mirror's channel and the mirror is slow, it waits for the slow answer while the fast one stays unread. If it receives from the primary's channel, the same problem appears whenever the primary is the slow one

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content