mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
🎨 改进内核任务调度机制提升稳定性 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
|
waitSecondForExecInstallPkg := false
|
||||||
if !skipNewVerInstallPkg() {
|
if !skipNewVerInstallPkg() {
|
||||||
newVerInstallPkgPath := getNewVerInstallPkgPath()
|
newVerInstallPkgPath := getNewVerInstallPkgPath()
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,11 @@ const (
|
||||||
func Loop() {
|
func Loop() {
|
||||||
for {
|
for {
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(10 * time.Millisecond)
|
||||||
|
if QueueStatusClosing == taskQueueStatus {
|
||||||
|
clearQueue()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
task := popTask()
|
task := popTask()
|
||||||
if nil == task {
|
if nil == task {
|
||||||
continue
|
continue
|
||||||
|
|
@ -121,9 +126,6 @@ func Loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func CloseWait() {
|
func CloseWait() {
|
||||||
queueLock.Lock()
|
|
||||||
defer queueLock.Unlock()
|
|
||||||
|
|
||||||
taskQueueStatus = QueueStatusClosing
|
taskQueueStatus = QueueStatusClosing
|
||||||
for {
|
for {
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(10 * time.Millisecond)
|
||||||
|
|
@ -133,6 +135,13 @@ func CloseWait() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clearQueue() {
|
||||||
|
queueLock.Lock()
|
||||||
|
defer queueLock.Unlock()
|
||||||
|
|
||||||
|
taskQueue = []*Task{}
|
||||||
|
}
|
||||||
|
|
||||||
func popTask() (ret *Task) {
|
func popTask() (ret *Task) {
|
||||||
queueLock.Lock()
|
queueLock.Lock()
|
||||||
defer queueLock.Unlock()
|
defer queueLock.Unlock()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue