mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 00:50:55 +00:00
fix deadlock in task module
This commit is contained in:
parent
c5d43e87fe
commit
4dc694411f
@ -451,6 +451,11 @@ func run() {
|
|||||||
taskLock.Unlock()
|
taskLock.Unlock()
|
||||||
continue
|
continue
|
||||||
case <-stop:
|
case <-stop:
|
||||||
|
taskLock.Lock()
|
||||||
|
if isstart {
|
||||||
|
isstart = false
|
||||||
|
}
|
||||||
|
taskLock.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -458,13 +463,7 @@ func run() {
|
|||||||
|
|
||||||
// StopTask stop all tasks
|
// StopTask stop all tasks
|
||||||
func StopTask() {
|
func StopTask() {
|
||||||
taskLock.Lock()
|
stop <- true
|
||||||
defer taskLock.Unlock()
|
|
||||||
if isstart {
|
|
||||||
isstart = false
|
|
||||||
stop <- true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddTask add task with name
|
// AddTask add task with name
|
||||||
|
Loading…
Reference in New Issue
Block a user