From owner-cvs-src@FreeBSD.ORG Sun May 25 01:48:11 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA1EC37B401; Sun, 25 May 2003 01:48:11 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 79D6C43F3F; Sun, 25 May 2003 01:48:11 -0700 (PDT) (envelope-from mtm@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h4P8mB0U056333; Sun, 25 May 2003 01:48:11 -0700 (PDT) (envelope-from mtm@repoman.freebsd.org) Received: (from mtm@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h4P8mBpD056332; Sun, 25 May 2003 01:48:11 -0700 (PDT) Message-Id: <200305250848.h4P8mBpD056332@repoman.freebsd.org> From: Mike Makonnen Date: Sun, 25 May 2003 01:48:11 -0700 (PDT) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/lib/libthr/thread thr_cancel.c thr_private.h thr_spinlock.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 May 2003 08:48:12 -0000 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