sentimensrg / ctx Goto Github PK
View Code? Open in Web Editor NEWComposable utilities for Go contexts
License: MIT License
Composable utilities for Go contexts
License: MIT License
@lthibault Opening a new issue per discussion in #4. The import side-effect is now resolved (awesome!) but I'm still seeing the signal.Stop() issue. Here is my test program again:
package main
import (
"log"
"os"
"time"
"github.com/SentimensRG/ctx/sigctx" // ctrl-c will not work if you pass `server` as an arg
//"github.com/mhupman/ctx/sigctx" // ctrl-c will work in either case
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "server" {
go startServer()
}
log.Println("starting some kind of long running op - ctrl-c to quit me!")
for {
time.Sleep(time.Second)
}
}
func startServer() {
log.Println("starting server")
<-sigctx.New().Done()
log.Println("server done")
}
No matter how many times I ctrl-c
, it hangs. If I add a signal.Stop(sigCh)
on sigctx/sigctx.go#38 it seems to fix the problem and SIGINTs will cause a program exit.
$ go test -cover -race ./... (328ms)
ok github.com/SentimensRG/ctx 1.035s coverage: 73.0% of statements
ok github.com/SentimensRG/ctx/mergectx 1.711s coverage: 54.0% of statements
ok github.com/SentimensRG/ctx/refctx 1.032s coverage: 75.0% of statements
? github.com/SentimensRG/ctx/sigctx [no test files]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.