Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go Timer - haoc7 #820

Open
itcuihao opened this issue Jun 10, 2022 · 0 comments
Open

Go Timer - haoc7 #820

itcuihao opened this issue Jun 10, 2022 · 0 comments

Comments

@itcuihao
Copy link
Owner

http://cuihao.fun/post/go-timer/

假如有需求需要定时执行某一程序,会用到定时器,不过在设置定时器后想主动取消,就需要借助下context。 Go Timer 主动停止 package main import ( "context" "fmt" "runtime/debug" "sync" "time" ) func main() { mt := timerTest() time.Sleep(time.Second * 30) for i, tt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant