Prevent nested signals, fix check for PID > 0

This commit is contained in:
Jeremy Soller
2017-07-23 16:02:48 -06:00
parent 07262fd866
commit ef8c120533
2 changed files with 7 additions and 3 deletions

View File

@@ -98,7 +98,9 @@ pub unsafe fn switch() -> bool {
let mut context = context_lock.write();
if check_context(&mut context) {
to_ptr = context.deref_mut() as *mut Context;
to_sig = context.pending.pop_front();
if (&mut *to_ptr).ksig.is_none() {
to_sig = context.pending.pop_front();
}
break;
}
}
@@ -110,7 +112,9 @@ pub unsafe fn switch() -> bool {
let mut context = context_lock.write();
if check_context(&mut context) {
to_ptr = context.deref_mut() as *mut Context;
to_sig = context.pending.pop_front();
if (&mut *to_ptr).ksig.is_none() {
to_sig = context.pending.pop_front();
}
break;
}
}

View File

@@ -1041,7 +1041,7 @@ pub fn kill(pid: ContextId, sig: usize) -> Result<usize> {
}
};
if pid.into() > 0 {
if pid.into() as isize > 0 {
// Send to a single process
if let Some(context_lock) = contexts.get(pid) {
let mut context = context_lock.write();