Logo

Programming-Idioms

History of Idiom 185 > diff from v2 to v3

Edit summary for version 3 by programming-idioms.org:
New Go implementation by user [programming-idioms.org]

Version 2

2019-09-09, 08:55:59

Version 3

2019-09-09, 08:59:16

Idiom #185 Execute function in 30 seconds

Schedule the execution of f(42) in 30 seconds.

Idiom #185 Execute function in 30 seconds

Schedule the execution of f(42) in 30 seconds.

Extra Keywords
future
Extra Keywords
future
Imports
import  "time"
Code
go func() {
	time.Sleep(3 * time.Second)
	f(42)
}()
Comments bubble
Consider adding proper synchronization where needed. Data races are forbidden!
Doc URL
https://golang.org/pkg/time/#Sleep
Demo URL
https://play.golang.org/p/0vUfK-ZOgZr