Javatpoint Logo
Javatpoint Logo

Go Channel

The channel acts as a pipe by which we send typed values from one Goroutine to another. It guarantees synchronization since only one Goroutine has access to a data item at any given time. The ownership of the data is passed between different Goroutine. Hence, By design it avoids the pitfalls of shared memory and prevent race condition.

Go Channel Example

Output:

working...done

Next TopicGo Worker Pools





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA