Add some locking asserts and some comments

This commit is contained in:
Julian Elischer 2002-07-24 23:21:05 +00:00
parent 966ae27385
commit b6d5995e5f
4 changed files with 10 additions and 0 deletions

View File

@ -271,6 +271,7 @@ trap(frame)
/*
* First check that we shouldn't just abort.
* But check if we are the single thread first!
* XXX p_singlethread not locked, but should be safe.
*/
if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) {
PROC_LOCK(p); /* check if thisis really needed */

View File

@ -271,6 +271,7 @@ trap(frame)
/*
* First check that we shouldn't just abort.
* But check if we are the single thread first!
* XXX p_singlethread not locked, but should be safe.
*/
if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) {
PROC_LOCK(p); /* check if thisis really needed */

View File

@ -589,6 +589,7 @@ thread_single(int force_exit)
td = curthread;
p = td->td_proc;
mtx_assert(&sched_lock, MA_OWNED);
PROC_LOCK_ASSERT(p, MA_OWNED);
KASSERT((td != NULL), ("curthread is NULL"));
@ -707,6 +708,8 @@ thread_suspend_check(int return_instead)
* a single-threading. Treat it ever
* so slightly different if it is
* in a special situation.
* XXX Should be safe to access unlocked
* as it can only be set to be true by us.
*/
if (p->p_singlethread == td) {
return (0); /* Exempt from stopping. */
@ -772,6 +775,7 @@ thread_unsuspend(struct proc *p)
{
struct thread *td;
mtx_assert(&sched_lock, MA_OWNED);
PROC_LOCK_ASSERT(p, MA_OWNED);
if (!P_SHOULDSTOP(p)) {
while (( td = TAILQ_FIRST(&p->p_suspended))) {

View File

@ -589,6 +589,7 @@ thread_single(int force_exit)
td = curthread;
p = td->td_proc;
mtx_assert(&sched_lock, MA_OWNED);
PROC_LOCK_ASSERT(p, MA_OWNED);
KASSERT((td != NULL), ("curthread is NULL"));
@ -707,6 +708,8 @@ thread_suspend_check(int return_instead)
* a single-threading. Treat it ever
* so slightly different if it is
* in a special situation.
* XXX Should be safe to access unlocked
* as it can only be set to be true by us.
*/
if (p->p_singlethread == td) {
return (0); /* Exempt from stopping. */
@ -772,6 +775,7 @@ thread_unsuspend(struct proc *p)
{
struct thread *td;
mtx_assert(&sched_lock, MA_OWNED);
PROC_LOCK_ASSERT(p, MA_OWNED);
if (!P_SHOULDSTOP(p)) {
while (( td = TAILQ_FIRST(&p->p_suspended))) {