From owner-cvs-src@FreeBSD.ORG Tue Jun 12 07:24:47 2007 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6236816A400; Tue, 12 Jun 2007 07:24:47 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 547B213C45B; Tue, 12 Jun 2007 07:24:47 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5C7OlxY088329; Tue, 12 Jun 2007 07:24:47 GMT (envelope-from jeff@repoman.freebsd.org) Received: (from jeff@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5C7Olwd088327; Tue, 12 Jun 2007 07:24:47 GMT (envelope-from jeff) Message-Id: <200706120724.l5C7Olwd088327@repoman.freebsd.org> From: Jeff Roberson Date: Tue, 12 Jun 2007 07:24:47 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/sys proc.h src/sys/kern kern_thread.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 12 Jun 2007 07:24:47 -0000 jeff 2007-06-12 07:24:47 UTC FreeBSD src repository Modified files: sys/sys proc.h sys/kern kern_thread.c Log: Solve a complex exit race introduced with thread_lock: - Add a count of exiting threads, p_exitthreads, to struct proc. - Increment p_exithreads when we set the deadthread in thread_exit(). - When we thread_stash() a deadthread use an atomic to drop the count. - Spin until the p_exithreads count reaches 0 in thread_wait(). - Lock the last exiting thread momentarily to be certain that it has exited cpu_throw(). - Restructure thread_wait(). It does not need a loop as there will only ever be one thread. Tested by: moose@opera.com Reported by: kris, moose@opera.com Revision Changes Path 1.249 +33 -15 src/sys/kern/kern_thread.c 1.484 +1 -0 src/sys/sys/proc.h