Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(878)

Unified Diff: src/cmd/go/signal.go

Issue 6943043: cmd/go: unblock all workers on signal (Closed)
Patch Set: diff -r 3fe40a41018d https://code.google.com/p/go Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/go/build.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/go/signal.go
===================================================================
new file mode 100644
--- /dev/null
+++ b/src/cmd/go/signal.go
@@ -0,0 +1,32 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "os"
+ "os/signal"
+ "sync"
+)
+
+var interrupted = make(chan struct{})
+
+// ignoreSignals setup for some signals to be ignored.
+func ignoreSignals() {
+ sig := make(chan os.Signal)
+ signal.Notify(sig, signalsToIgnore...)
+ go func() {
+ for _ = range sig {
+ close(interrupted)
+ return
+ }
+ }()
+}
+
+var onceIgnoreSignals sync.Once
+
+// startSigHandlers start signal handlers.
+func startSigHandlers() {
+ onceIgnoreSignals.Do(ignoreSignals)
+}
« no previous file with comments | « src/cmd/go/build.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b