|
|
|
|
|
by thrance
234 days ago
|
|
It doesn't matter if you use channels or mutexes to communicate between tasks, you still need your function to be async to spawn it as a coroutine. Your only choice is between coroutines (async tasks spawned on an executor) or regular OS threads. Channels work with both, the rule of thumb is to use async when your workload is IO-bound, and threads when it is compute-bound. Then, it's up to you whether you communicate by sharing memory or share memory by communicating. |
|
Even folks who write modern go try to avoid overusing channels. It's quite common to see go codebases with few or no channels.