https://github.com/markbates/sigtx
a context implementation for signal capturing
https://github.com/markbates/sigtx
Last synced: 4 months ago
JSON representation
a context implementation for signal capturing
- Host: GitHub
- URL: https://github.com/markbates/sigtx
- Owner: markbates
- License: mit
- Created: 2017-08-18T15:18:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-13T22:35:29.000Z (almost 8 years ago)
- Last Synced: 2025-02-28T04:57:00.832Z (5 months ago)
- Language: Go
- Size: 1.95 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# sigtx [](https://travis-ci.org/markbates/sigtx)
This package provides an implementation proposal for this Go proposal: [https://github.com/golang/go/issues/21521](https://github.com/golang/go/issues/21521).
## Usage
```go
package mainimport (
"context"
"fmt"
"os"
"syscall""github.com/markbates/sigtx"
)func main() {
ctx, cancel := sigtx.WithCancel(context.Background(), os.Interrupt, syscall.SIGTERM, syscall.SIGKILL)
defer cancel()
select {
case <-ctx.Done():
fmt.Println("thanks for stopping me")
}
}
```