Add some locking asserts and some comments
This commit is contained in:
parent
966ae27385
commit
b6d5995e5f
@ -271,6 +271,7 @@ trap(frame)
|
|||||||
/*
|
/*
|
||||||
* First check that we shouldn't just abort.
|
* First check that we shouldn't just abort.
|
||||||
* But check if we are the single thread first!
|
* 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)) {
|
if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) {
|
||||||
PROC_LOCK(p); /* check if thisis really needed */
|
PROC_LOCK(p); /* check if thisis really needed */
|
||||||
|
@ -271,6 +271,7 @@ trap(frame)
|
|||||||
/*
|
/*
|
||||||
* First check that we shouldn't just abort.
|
* First check that we shouldn't just abort.
|
||||||
* But check if we are the single thread first!
|
* 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)) {
|
if ((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) {
|
||||||
PROC_LOCK(p); /* check if thisis really needed */
|
PROC_LOCK(p); /* check if thisis really needed */
|
||||||
|
@ -589,6 +589,7 @@ thread_single(int force_exit)
|
|||||||
|
|
||||||
td = curthread;
|
td = curthread;
|
||||||
p = td->td_proc;
|
p = td->td_proc;
|
||||||
|
mtx_assert(&sched_lock, MA_OWNED);
|
||||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
PROC_LOCK_ASSERT(p, MA_OWNED);
|
||||||
KASSERT((td != NULL), ("curthread is NULL"));
|
KASSERT((td != NULL), ("curthread is NULL"));
|
||||||
|
|
||||||
@ -707,6 +708,8 @@ thread_suspend_check(int return_instead)
|
|||||||
* a single-threading. Treat it ever
|
* a single-threading. Treat it ever
|
||||||
* so slightly different if it is
|
* so slightly different if it is
|
||||||
* in a special situation.
|
* 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) {
|
if (p->p_singlethread == td) {
|
||||||
return (0); /* Exempt from stopping. */
|
return (0); /* Exempt from stopping. */
|
||||||
@ -772,6 +775,7 @@ thread_unsuspend(struct proc *p)
|
|||||||
{
|
{
|
||||||
struct thread *td;
|
struct thread *td;
|
||||||
|
|
||||||
|
mtx_assert(&sched_lock, MA_OWNED);
|
||||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
PROC_LOCK_ASSERT(p, MA_OWNED);
|
||||||
if (!P_SHOULDSTOP(p)) {
|
if (!P_SHOULDSTOP(p)) {
|
||||||
while (( td = TAILQ_FIRST(&p->p_suspended))) {
|
while (( td = TAILQ_FIRST(&p->p_suspended))) {
|
||||||
|
@ -589,6 +589,7 @@ thread_single(int force_exit)
|
|||||||
|
|
||||||
td = curthread;
|
td = curthread;
|
||||||
p = td->td_proc;
|
p = td->td_proc;
|
||||||
|
mtx_assert(&sched_lock, MA_OWNED);
|
||||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
PROC_LOCK_ASSERT(p, MA_OWNED);
|
||||||
KASSERT((td != NULL), ("curthread is NULL"));
|
KASSERT((td != NULL), ("curthread is NULL"));
|
||||||
|
|
||||||
@ -707,6 +708,8 @@ thread_suspend_check(int return_instead)
|
|||||||
* a single-threading. Treat it ever
|
* a single-threading. Treat it ever
|
||||||
* so slightly different if it is
|
* so slightly different if it is
|
||||||
* in a special situation.
|
* 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) {
|
if (p->p_singlethread == td) {
|
||||||
return (0); /* Exempt from stopping. */
|
return (0); /* Exempt from stopping. */
|
||||||
@ -772,6 +775,7 @@ thread_unsuspend(struct proc *p)
|
|||||||
{
|
{
|
||||||
struct thread *td;
|
struct thread *td;
|
||||||
|
|
||||||
|
mtx_assert(&sched_lock, MA_OWNED);
|
||||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
PROC_LOCK_ASSERT(p, MA_OWNED);
|
||||||
if (!P_SHOULDSTOP(p)) {
|
if (!P_SHOULDSTOP(p)) {
|
||||||
while (( td = TAILQ_FIRST(&p->p_suspended))) {
|
while (( td = TAILQ_FIRST(&p->p_suspended))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user