https://github.com/akramarenkov/breaker
Library that provides to break goroutine and wait it completion
https://github.com/akramarenkov/breaker
break complete go golang
Last synced: about 1 year ago
JSON representation
Library that provides to break goroutine and wait it completion
- Host: GitHub
- URL: https://github.com/akramarenkov/breaker
- Owner: akramarenkov
- License: mit
- Created: 2024-01-17T13:10:23.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-15T16:29:24.000Z (over 1 year ago)
- Last Synced: 2025-03-15T17:28:47.011Z (over 1 year ago)
- Topics: break, complete, go, golang
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# Breaker
[](https://pkg.go.dev/github.com/akramarenkov/breaker)
[](https://goreportcard.com/report/github.com/akramarenkov/breaker)
[](https://coveralls.io/github/akramarenkov/breaker)
## Purpose
Library that provides to break goroutine and wait it completion
## Usage
Example:
```go
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
}
```