From owner-freebsd-threads@FreeBSD.ORG Mon Apr 28 22:28:35 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4AFD437B401; Mon, 28 Apr 2003 22:28:35 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 87C9B43FDD; Mon, 28 Apr 2003 22:28:34 -0700 (PDT) (envelope-from eischen@pcnet1.pcnet.com) Received: from pcnet1.pcnet.com (localhost [127.0.0.1]) by mail.pcnet.com (8.12.8/8.12.1) with ESMTP id h3T5SXBg028194; Tue, 29 Apr 2003 01:28:33 -0400 (EDT) Received: from localhost (eischen@localhost)h3T5SXHX028189; Tue, 29 Apr 2003 01:28:33 -0400 (EDT) Date: Tue, 29 Apr 2003 01:28:33 -0400 (EDT) From: Daniel Eischen To: Peter Wemm In-Reply-To: <20030429041716.A14182A7EA@canning.wemm.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: jdp@freebsd.org cc: threads@freebsd.org Subject: Re: Question about rtld-elf. Anyone?.. Anyone? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Apr 2003 05:28:35 -0000 On Mon, 28 Apr 2003, Peter Wemm wrote: > Daniel Eischen wrote: > > So I was glancing at rltd-elf, specifically lockdflt.c. There > > seems to be an assumption that sigprocmask() can be used to > > protect a thread from being swapped out. Am I reading this > > right? > > I dont think so.. i386/lockdflt.c is just a simple spinlock that happens > to work with libc_r. > > > There are no such guarantees with libpthread. A thread > > will be swapped out whenever its quantum expires, and if > > you've got higher priority threads, they will always run > > before those of lower priority -- even if they are spinning. > > If this is happening, it would not suprise me. lockdflt.c seems more aimed > at things like the M3 runtime. > > I think the real solution is to provide a way for a thread library to hook > in its own lock routines that use something that is thread aware. However, > this is probably easier said than done. Well, libc can do it by checking __isthreaded and then using mutexes. Libraries such as libgcc can also handle it by making weak references (not definitions) to pthread_foo and then using them when they are not null. I don't know if this works for rtld though. > Basically he's describing the exact scenario you're concerned about. The > last paragraph suggests a better way. John, any details about what you were thinking here? -- Dan Eischen