This code is extremely bogus:
|
// WaitForResume need to call before current process got suspend. |
|
// It will run a ticker until a long duration is occurs, |
|
// which means this process is resumed. |
|
func WaitForResume() chan struct{} { |
|
ch := make(chan struct{}) |
|
var wg sync.WaitGroup |
|
wg.Add(1) |
|
go func() { |
|
ticker := time.NewTicker(10 * time.Millisecond) |
|
t := time.Now() |
|
wg.Done() |
|
for { |
|
now := <-ticker.C |
|
if now.Sub(t) > 100*time.Millisecond { |
|
break |
|
} |
|
t = now |
|
} |
|
ticker.Stop() |
|
ch <- struct{}{} |
|
}() |
|
wg.Wait() |
|
return ch |
|
} |
Instead, resumption should be detected by handling SIGCONT. (Not sure about the story on Windows.)
This code is extremely bogus:
readline/utils.go
Lines 60 to 83 in cd7fbcc
Instead, resumption should be detected by handling SIGCONT. (Not sure about the story on Windows.)