Channels
Overview
We have routines running using our go function, but what if we want those routines to communicate? Let's say that our routine A needs a computation result from routine B in order to complete. That's where you need channels for the purposes of communication. All code related to channels lies in csp-coffee/channel
package. Let's show an example implementation of the problem above using our library.
Here we have two simple generator functions and a channel. We pass two values to adderRoutine
which calculates a sum of two numbers and puts it to our channel. loggerRoutine
waits for a value to appear in the channel, takes it and logs it. That's i
Last updated