🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113
This commit is contained in:
parent
71a8c4e31b
commit
89fd4d9264
2 changed files with 12 additions and 9 deletions
|
@ -406,12 +406,6 @@ func Close(force bool, execInstallPkg int) (exitCode int) {
|
|||
}
|
||||
}
|
||||
|
||||
//util.UIProcessIDs.Range(func(key, _ interface{}) bool {
|
||||
// pid := key.(string)
|
||||
// util.Kill(pid)
|
||||
// return true
|
||||
//})
|
||||
|
||||
waitSecondForExecInstallPkg := false
|
||||
if !skipNewVerInstallPkg() {
|
||||
newVerInstallPkgPath := getNewVerInstallPkgPath()
|
||||
|
|
|
@ -111,6 +111,11 @@ const (
|
|||
func Loop() {
|
||||
for {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if QueueStatusClosing == taskQueueStatus {
|
||||
clearQueue()
|
||||
break
|
||||
}
|
||||
|
||||
task := popTask()
|
||||
if nil == task {
|
||||
continue
|
||||
|
@ -121,9 +126,6 @@ func Loop() {
|
|||
}
|
||||
|
||||
func CloseWait() {
|
||||
queueLock.Lock()
|
||||
defer queueLock.Unlock()
|
||||
|
||||
taskQueueStatus = QueueStatusClosing
|
||||
for {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
@ -133,6 +135,13 @@ func CloseWait() {
|
|||
}
|
||||
}
|
||||
|
||||
func clearQueue() {
|
||||
queueLock.Lock()
|
||||
defer queueLock.Unlock()
|
||||
|
||||
taskQueue = []*Task{}
|
||||
}
|
||||
|
||||
func popTask() (ret *Task) {
|
||||
queueLock.Lock()
|
||||
defer queueLock.Unlock()
|
||||
|
|
Loading…
Add table
Reference in a new issue