diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2004-08-19 11:31:42 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2004-08-19 11:31:42 +0000 |
| commit | 007ddf7e7a6497ff80781f90ace61facd89be911 (patch) | |
| tree | 0e4978383f95ccaee9fad964201d8694bc8eaf63 /sys/kern/kern_thread.c | |
| parent | 3648c3517ac1357b4eb5889be444901ecaf9efe6 (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_thread.c')
| -rw-r--r-- | sys/kern/kern_thread.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 99b692b0e352..f16e2f61127f 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1110,3 +1110,22 @@ thread_single_end(void) mtx_unlock_spin(&sched_lock); } +/* + * Called before going into an interruptible sleep to see if we have been + * interrupted or requested to exit. + */ +int +thread_sleep_check(struct thread *td) +{ + struct proc *p; + + p = td->td_proc; + mtx_assert(&sched_lock, MA_OWNED); + if (p->p_flag & P_SA || p->p_numthreads > 1) { + if ((p->p_flag & P_SINGLE_EXIT) && p->p_singlethread != td) + return (EINTR); + if (td->td_flags & TDF_INTERRUPT) + return (td->td_intrval); + } + return (0); +} |
