Last active
September 27, 2021 13:23
-
-
Save Israel-Miles/ed1d0b62d4278f3c3c7ca87f5c2c467f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
func main() { | |
start := time.Now() | |
for i := 1; i <= 10; i++ { | |
go executeTask(i) | |
} | |
time.Sleep(300 * time.Millisecond) | |
fmt.Println("Total execution time:", time.Since(start)) | |
} | |
func executeTask(i int) { | |
fmt.Println("Executing task", i) | |
time.Sleep(250 * time.Millisecond) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment