Skip to content

Library that provides to break goroutine and wait it completion

License

Notifications You must be signed in to change notification settings

akramarenkov/breaker

Repository files navigation

Breaker

Go Reference Go Report Card Coverage Status

Purpose

Library that provides to break goroutine and wait it completion

Usage

Example:

package main

import (
    "fmt"

    "github.com/akramarenkov/breaker"
)

func main() {
    brk := breaker.New()

    go func() {
        defer brk.Complete()

        _, opened := <-brk.IsBreaked()

        fmt.Println(opened)
    }()

    brk.Break()

    fmt.Println(brk.IsStopped())
    // Output:
    // false
    // true
}

About

Library that provides to break goroutine and wait it completion

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages