Last active
April 5, 2019 14:26
-
-
Save farkaskid/66171850ee0d967489b212f9d7c54743 to your computer and use it in GitHub Desktop.
Goroutine example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This function performs the given task concurrently by spawing a goroutine | |
// for each of those tasks. | |
func performAsyncTasks(task []Task) { | |
for _, task := range tasks { | |
// This will spawn a separate goroutine to carry out this task. | |
// This call is non-blocking | |
go task.Execute() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Farkaskid,
read your medium post and i just wanted to commend you for it.
I noticed a mistake in this example, i generally get the idea, but so it's not confusing for newbie, i just want to point it out.
The parameter name for performAsyncTasks() should be tasks instead of task.