cvs commit: src/lib/libthr/thread thr_cancel.c thr_private.h
thr_spinlock.c
Mike Makonnen
mtm at FreeBSD.org
Sun May 25 01:48:12 PDT 2003
mtm 2003/05/25 01:48:11 PDT
FreeBSD src repository
Modified files:
lib/libthr/thread thr_cancel.c thr_private.h thr_spinlock.c
Log:
_pthread_cancel() breaks the normal lock order of first locking the
joined and then the joiner thread. There isn't an easy (sane?) way
to make it use the correct order without introducing races involving
the target thread and finding which (active or dead) list it is on. So,
after locking the canceled thread it will try to lock the joined thread
and if it fails release the first lock and try again from the top.
Introduce a new function, _spintrylock, which is simply a wrapper arround
umtx_trylock(), to help accomplish this.
Approved by: re/blanket libthr
Revision Changes Path
1.5 +17 -4 src/lib/libthr/thread/thr_cancel.c
1.12 +1 -0 src/lib/libthr/thread/thr_private.h
1.4 +10 -0 src/lib/libthr/thread/thr_spinlock.c
More information about the cvs-all
mailing list