Set td_critnest to 1 when setting up a thread since it is a MI field with

MI values.  This ensures that td_critnest for a newly fork'd thread is
always valid.

Requested by:	bde (a long time ago)
This commit is contained in:
jhb 2003-08-04 20:28:20 +00:00
parent a69166c61f
commit 52adb98aef
3 changed files with 3 additions and 1 deletions

View File

@ -142,6 +142,7 @@ thread_ctor(void *mem, int size, void *arg)
td = (struct thread *)mem;
td->td_state = TDS_INACTIVE;
td->td_oncpu = NOCPU;
td->td_critnest = 1;
}
/*

View File

@ -142,6 +142,7 @@ thread_ctor(void *mem, int size, void *arg)
td = (struct thread *)mem;
td->td_state = TDS_INACTIVE;
td->td_oncpu = NOCPU;
td->td_critnest = 1;
}
/*

View File

@ -294,7 +294,6 @@ struct thread {
u_int td_uuticks; /* (*) Statclock in user, for UTS */
u_int td_usticks; /* (*) Statclock in kernel, for UTS */
int td_intrval; /* (*) Return value of TDF_INTERRUPT */
u_int td_critnest; /* (k) Critical section nest level. */
sigset_t td_oldsigmask; /* (k) Saved mask from pre sigpause. */
sigset_t td_sigmask; /* (c) Current signal mask. */
sigset_t td_siglist; /* (c) Sigs arrived, not delivered. */
@ -330,6 +329,7 @@ struct thread {
struct vm_object *td_altkstack_obj;/* (a) Alternate kstack object. */
vm_offset_t td_altkstack; /* (a) Kernel VA of alternate kstack. */
int td_altkstack_pages; /* (a) Size of the alternate kstack */
u_int td_critnest; /* (k) Critical section nest level. */
struct mdthread td_md; /* (k) Any machine-dependent fields. */
struct td_sched *td_sched; /* (*) Scheduler specific data */
};