Only test return_instead if P_SINGLE_EXIT is set, otherwise a fork()

syscall can interrupt other thread's syscall in sleepq_catch_signals().
Current, all callers know thread_suspend_check may suspend thread
itself, so we need't to check return_instead for normal suspension
flags (no P_SINGLE_EXIT set).

Tested by: deischen
Reported by: Maarten L. Hekkelman <m.hekkelman@cmbi.kun.nl>
This commit is contained in:
David Xu 2004-08-29 23:10:02 +00:00
parent 9b98b79683
commit 45a4bfa17d

View File

@ -989,7 +989,7 @@ thread_suspend_check(int return_instead)
if (p->p_singlethread == td)
return (0); /* Exempt from stopping. */
}
if (return_instead)
if ((p->p_flag & P_SINGLE_EXIT) && return_instead)
return (1);
mtx_lock_spin(&sched_lock);