Skip to content

scontrol (Status Control) is a go package providing gorountine control by status.

License

Notifications You must be signed in to change notification settings

zetako/scontrol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scontrol - Status Control

scontrol is a go package providing go routine control.

Usage

Use New() to get a new controller

sc := scontrol.New()

Use Set() to set controller into new status; it's okay to set a same status.

sc.Set(scontrol.StatusPause)

The go routines being controlled can use Check() to get status; it status now is pause, it will block until status changed (means that Set() has been called)

go func(){
    for sc.Check() != scontrol.StatusStop {
        // DO its own work
    }
}()

About

scontrol (Status Control) is a go package providing gorountine control by status.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages