From: George Dunlap <george.dun...@citrix.com>

Otherwise you have to kill -9 the process.

Signed-off-by: George Dunlap <george.dun...@citrix.com>
---
 main.go | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/main.go b/main.go
index 04c8467..dbd6276 100644
--- a/main.go
+++ b/main.go
@@ -62,6 +62,8 @@ func (ws *WorkerList) Start(report chan WorkerReport, done 
chan bool) {
 }
 
 func main() {
+       killed := false
+       
        count := 2
        
        report := make(chan WorkerReport)
@@ -92,9 +94,15 @@ func main() {
                        i--;
                        fmt.Println(i, "workers left");
                case <-signals:
-                       fmt.Println("SIGINT receieved, shutting down workers")
-                       for j := range Workers {
-                               Workers[j].w.Shutdown()
+                       if ! killed {
+                               fmt.Println("SIGINT receieved, shutting down 
workers")
+                               for j := range Workers {
+                                       Workers[j].w.Shutdown()
+                               }
+                               killed = true
+                       } else {
+                               fmt.Println("Second SIGINT received, exiting 
without cleaning up")
+                               os.Exit(1)
                        }
                }
        }
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to