mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-05-02 00:00:01 -05:00
🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113
This commit is contained in:
+12
-3
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user