diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -187,6 +187,7 @@ int suspend_kproc(struct thread *td, int timo) { + int timeout = 0; if (td->td_proc == NULL) { lwkt_gettoken(&kpsus_token); /* request thread pause */ @@ -194,12 +195,14 @@ wakeup(td); while (td->td_mpflags & TDF_MP_STOPREQ) { int error = tsleep(td, 0, "suspkp", timo); - if (error == EWOULDBLOCK) + if (error == EWOULDBLOCK) { + timeout = 1; break; + } } atomic_clear_int(&td->td_mpflags, TDF_MP_STOPREQ); lwkt_reltoken(&kpsus_token); - return(0); + return (timeout ? EWOULDBLOCK : 0); } else { return(EINVAL); /* not a kernel thread */ }