Skip to content

Commit 87d47a6

Browse files
committed
fix compile
1 parent a0a79f0 commit 87d47a6

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

core/src/scheduler.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl<'s> Scheduler<'s> {
228228
.expect("change syscall state failed");
229229
}
230230
//协程在系统调用执行期间被信号抢占,直接放回就绪队列
231-
CoroutineState::Syscall(_, _, SyscallState::Executing) => {}
231+
CoroutineState::Syscall((), _, SyscallState::Executing) => {}
232232
_ => unreachable!("try_resume unexpect CoroutineState"),
233233
}
234234
self.ready.push(co);
@@ -313,12 +313,17 @@ impl<'s> Scheduler<'s> {
313313
_ = RUNNING_COROUTINES.remove(&co_id);
314314
})? {
315315
CoroutineState::Syscall((), _, state) => {
316-
//挂起协程到系统调用表
317-
//如果已包含,说明当前系统调用还有上层父系统调用,因此直接忽略插入结果
318-
_ = self.syscall.insert(co_id, coroutine);
319-
if let SyscallState::Suspend(timestamp) = state {
320-
self.syscall_suspend
321-
.push(SyscallSuspendItem { timestamp, co_id });
316+
if let SyscallState::Executing = state {
317+
//协程在系统调用执行期间被信号抢占,放回就绪队列以恢复执行
318+
self.ready.push(coroutine);
319+
} else {
320+
//挂起协程到系统调用表
321+
//如果已包含,说明当前系统调用还有上层父系统调用,因此直接忽略插入结果
322+
_ = self.syscall.insert(co_id, coroutine);
323+
if let SyscallState::Suspend(timestamp) = state {
324+
self.syscall_suspend
325+
.push(SyscallSuspendItem { timestamp, co_id });
326+
}
322327
}
323328
}
324329
CoroutineState::Suspend((), timestamp) => {
@@ -395,7 +400,7 @@ impl<'s> Scheduler<'s> {
395400
.filter(|entry| {
396401
matches!(
397402
entry.value().state(),
398-
CoroutineState::Syscall(_, _, SyscallState::Executing)
403+
CoroutineState::Syscall((), _, SyscallState::Executing)
399404
)
400405
})
401406
.map(|entry| *entry.key())

0 commit comments

Comments
 (0)