add lock
This commit is contained in:
parent
16ae4fae3d
commit
36dbdd5d27
4
typed.go
4
typed.go
@ -36,6 +36,7 @@ var (
|
||||
stacks starmap.StarStack
|
||||
stackStarted bool = false
|
||||
stackStopChan chan int
|
||||
stackMu sync.Mutex
|
||||
stdScreen io.Writer = colorable.NewColorableStdout()
|
||||
)
|
||||
|
||||
@ -145,11 +146,14 @@ func generateId() string {
|
||||
}
|
||||
|
||||
func StartStacks() {
|
||||
stackMu.Lock()
|
||||
if stackStarted {
|
||||
stackMu.Unlock()
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
stackStarted = true
|
||||
stackMu.Unlock()
|
||||
defer func() {
|
||||
stackStarted = false
|
||||
}()
|
||||
|
Loading…
x
Reference in New Issue
Block a user