From owner-cvs-src-old@FreeBSD.ORG Wed Apr 20 14:19:43 2011 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A9811065769 for ; Wed, 20 Apr 2011 14:19:41 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 58ECC8FC17 for ; Wed, 20 Apr 2011 14:19:41 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.4/8.14.4) with ESMTP id p3KEJfaQ016009 for ; Wed, 20 Apr 2011 14:19:41 GMT (envelope-from rstone@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.4/8.14.4/Submit) id p3KEJfOk016008 for cvs-src-old@freebsd.org; Wed, 20 Apr 2011 14:19:41 GMT (envelope-from rstone@repoman.freebsd.org) Message-Id: <201104201419.p3KEJfOk016008@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to rstone@repoman.freebsd.org using -f From: Ryan Stone Date: Wed, 20 Apr 2011 14:19:34 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/lib/libthr/thread thr_once.c X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2011 14:19:43 -0000 rstone 2011-04-20 14:19:34 UTC FreeBSD src repository Modified files: lib/libthr/thread thr_once.c Log: SVN rev 220888 on 2011-04-20 14:19:34Z by rstone r179417 introduced a bug into pthread_once(). Previously pthread_once() used a global pthread_mutex_t for synchronization. r179417 replaced that with an implementation that directly used atomic instructions and thr_* syscalls to synchronize callers to pthread_once. However, calling pthread_mutex_lock on the global mutex implicitly ensured that _thr_check_init() had been called but with r179417 this was no longer guaranteed. This meant that if you were unlucky enough to have your first call into libthr be a call to pthread_once(), you would segfault when trying to access the pointer returned by _get_curthread(). The fix is to explicitly call _thr_check_init() from pthread_once(). Reviewed by: davidxu Approved by: emaste (mentor) MFC after: 1 week Revision Changes Path 1.8 +2 -0 src/lib/libthr/thread/thr_once.c