An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

# sigtx [![Build Status](https://travis-ci.org/markbates/sigtx.svg?branch=master)](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 main

import (
"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")
}
}
```