From owner-cvs-src@FreeBSD.ORG Thu Mar 30 13:46:57 2006 Return-Path: X-Original-To: cvs-src@freebsd.org 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 543E816A41F; Thu, 30 Mar 2006 13:46:57 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id E3C5D43D48; Thu, 30 Mar 2006 13:46:56 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.6/8.13.6/NETPLEX) with ESMTP id k2UDkpvQ011231; Thu, 30 Mar 2006 08:46:51 -0500 (EST) Date: Thu, 30 Mar 2006 08:46:51 -0500 (EST) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= In-Reply-To: <86k6actijt.fsf@xps.des.no> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/lib/librt sigev_thread.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Mar 2006 13:46:57 -0000 On Thu, 30 Mar 2006, Dag-Erling [iso-8859-1] Sm=F8rgrav wrote: > Daniel Eischen writes: > > Log: > > Account for recent changes in namespace.h. Use _pthread_create > > instead of pthread_create. > > I'm not sure this is correct. When we're inside libpthread or libthr, > we want to use the underscore versions of pthread_*() so we're sure > that we're referring to ourself and not to some third-party pthred > library that may have been mixed in somehow, but outside of it, we > want to refer to whichever pthread library the application developer > has chosen to use (he may even have his own compiled into the > application - been there, done that). I believe the correct fix in > this case is to move below "un-namespace.h". I don't think this is the right thing to do. We should take the same approach that libc takes. There are some subtleties with using the underscore versions of some of these functions, for instance _pthread_mutex_init. This creates a special mutex that puts a thread in a critical region when the mutex is locked. Signals are deferred. The consumer of librt doesn't know that mutexes, CVs, and threads are created behind the scenes, so he doesn't instrument his code with pthread_cleanup_push(), pthread_sigmask(), etc. Even if he did, there is no API for him to cleanup librt state. It may be possible to protect the necessary aio, timer, and mq functions with pthread_sigmask() and cleanup handlers, but I haven't looked at how much overhead this would add. --=20 DE