8000 GitHub - flybikeGx/easy-timeout: easy timeout in golang
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

flybikeGx/easy-timeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easy-timeout

easy timeout in golang

Usage

Install

go get github.com/flybikeGx/easy-timeout

Use

import "github.com/flybikeGx/easy-timeout/timelimit"

    ok := timelimit.Run(1*time.Second, func() {
        // your closure, main thread will be blocked
    })
    if !ok {
        // handle time out
    }

Guarantee

  1. Thread safe
  2. Stop at the exact time as golang timer

Notice

Closure safety should take care of

About

easy timeout in golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0