Subject: CVS commit: [wrstuden-fixsa] src/lib/libpthread
To: None <source-changes@NetBSD.org>
From: Bill Stouder-Studenmund <wrstuden@netbsd.org>
List: source-changes
Date: 10/19/2007 05:35:39
Module Name: src
Committed By: wrstuden
Date: Fri Oct 19 05:35:39 UTC 2007
Modified Files:
src/lib/libpthread [wrstuden-fixsa]: pthread.c pthread_int.h
pthread_run.c
Log Message:
Work on cleaning up lock ordering. Turns out that there's not too
much to do, other than fixing an issue in join and one I introduced.
Add volumous comment in pthread_int.h describing how I understand the
current locking to work.
pthread_join() considered pt_flaglock to be a higher-priority lock
than pt_join_lock. Life makes more sense if we flip that.
To not make a lot of routines messy, pthread__runqueue_lock has to be
lower in the lock ordering than pt_statelock. Adapt the changes I made
to sched_yield() to this ordering.
There still is a wart regarding setting the state of a thread
we are taking off of the run (or idle) queue. We can't lock
its pt_statelock as we have the runqueue lock held. For now,
go back to what the old code did which was just write over the info.
This isn't that bad as the only things that should be changing
the state of this thread should be run-queue savy. I need to check
this though....
To generate a diff of this commit:
cvs rdiff -r1.48.6.2 -r1.48.6.3 src/lib/libpthread/pthread.c
cvs rdiff -r1.34.4.2 -r1.34.4.3 src/lib/libpthread/pthread_int.h
cvs rdiff -r1.18.12.2 -r1.18.12.3 src/lib/libpthread/pthread_run.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.