master
兔子 3 years ago
parent 16ae4fae3d
commit 36dbdd5d27

@ -36,6 +36,7 @@ var (
stacks starmap.StarStack stacks starmap.StarStack
stackStarted bool = false stackStarted bool = false
stackStopChan chan int stackStopChan chan int
stackMu sync.Mutex
stdScreen io.Writer = colorable.NewColorableStdout() stdScreen io.Writer = colorable.NewColorableStdout()
) )
@ -145,11 +146,14 @@ func generateId() string {
} }
func StartStacks() { func StartStacks() {
stackMu.Lock()
if stackStarted { if stackStarted {
stackMu.Unlock()
return return
} }
go func() { go func() {
stackStarted = true stackStarted = true
stackMu.Unlock()
defer func() { defer func() {
stackStarted = false stackStarted = false
}() }()

Loading…
Cancel
Save