Date: Sun, 25 May 2003 01:48:11 -0700 (PDT) From: Mike Makonnen <mtm@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libthr/thread thr_cancel.c thr_private.h thr_spinlock.c Message-ID: <200305250848.h4P8mBpD056332@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305250848.h4P8mBpD056332>