Skip to content

Tell your waiting goroutines that something happened

License

Notifications You must be signed in to change notification settings

jordanbangia/signaler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

signaler

Tell your waiting goroutines that something happened in a threadsafe way.

ctx := context.Background()

s := signaler.New()

go func() {
    select {
        case <-ctx.Done():
            return
        case <-s.Subscribe():
            fmt.Println("I got the signal!")
    }
}()

time.Sleep(10 * time.Second)
s.Trigger()

About

Tell your waiting goroutines that something happened

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages