1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-06-06 05:51:54 +00:00

[bugfix] preempt, avoid deadlock

This commit is contained in:
Newnius 2020-08-13 21:17:34 +08:00
parent 63c121ae73
commit 3258e7d784

View File

@ -123,6 +123,7 @@ func (scheduler *SchedulerPriority) Start() {
copy(scheduler.history[idx:], scheduler.history[idx+1:])
scheduler.history = scheduler.history[:len(scheduler.history)-1]
}
scheduler.historyMu.Unlock()
/* add back */
idx = len(scheduler.queue)
@ -149,8 +150,9 @@ func (scheduler *SchedulerPriority) Start() {
log.Info("before=", before, " after=", after)
time.Sleep(time.Millisecond * 100)
}
} else {
scheduler.historyMu.Unlock()
}
scheduler.historyMu.Unlock()
}
}
scheduler.queueMu.Unlock()