diff --git a/core/src/coroutine/mod.rs b/core/src/coroutine/mod.rs
index ec220ebb..9f4463e1 100644
--- a/core/src/coroutine/mod.rs
+++ b/core/src/coroutine/mod.rs
@@ -147,8 +147,14 @@ impl<'c, Param, Yield, Return> Coroutine<'c, Param, Yield, Return> {
.is_ok()
{
extern "C" fn sigvtalrm_handler(_: libc::c_int) {
- if let Some(suspender) = suspender::Suspender::::current() {
- suspender.cancel();
+ if let Ok(mut set) = SigSet::thread_get_mask() {
+ //删除对SIGVTALRM信号的屏蔽,使信号处理函数即使在处理中,也可以再次进入信号处理函数
+ set.remove(Signal::SIGVTALRM);
+ set.thread_set_mask()
+ .expect("Failed to remove SIGVTALRM signal mask!");
+ if let Some(suspender) = suspender::Suspender::::current() {
+ suspender.cancel();
+ }
}
}
// install SIGVTALRM signal handler
diff --git a/open-coroutine/src/lib.rs b/open-coroutine/src/lib.rs
index ffd05410..4b3afba4 100644
--- a/open-coroutine/src/lib.rs
+++ b/open-coroutine/src/lib.rs
@@ -377,7 +377,7 @@ mod tests {
_ = any_join!(task!(|_| 1, ()), task!(|_| 2, ()), task!(|_| 3, ()));
task!(
|_| {
- println!("Try cancel!");
+ unreachable!("Try cancel!");
},
(),
)