From owner-freebsd-questions@FreeBSD.ORG Tue May 9 21:50:40 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5045B16A40D for ; Tue, 9 May 2006 21:50:40 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id EA8C343D45 for ; Tue, 9 May 2006 21:50:39 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.4) id k49Lodrq045569; Tue, 9 May 2006 16:50:39 -0500 (CDT) (envelope-from dan) Date: Tue, 9 May 2006 16:50:39 -0500 From: Dan Nelson To: Mark Kent Message-ID: <20060509215039.GB94315@dan.emsphone.com> References: <20060509213253.3F23128456@noc.mainstreet.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060509213253.3F23128456@noc.mainstreet.net> X-OS: FreeBSD 5.5-PRERELEASE X-message-flag: Outlook Error User-Agent: Mutt/1.5.11 Cc: freebsd-questions@freebsd.org Subject: Re: threads in 5.4 and 5.5 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 May 2006 21:50:40 -0000 In the last episode (May 09), Mark Kent said: > What is the canonical way to compile programs that use posix threads > on freebsd 5.4+, with gcc? > > I've seen comments that say that -pthread, used in 4.x, should go > away for 5.x. But, for example, /usr/ports/security/openssl uses > -pthread. -pthread is still the recommended way, I think. > And what does it mean when a program works with one thread > library and not another? I've got a case like this: > > libpthread.so.1: chew up cpu, then SEGV > libthr.so.1: chew up cpu, but works! > libc_r.so.5: works great! > > This is changed with libmap.conf. > > Does this point to any particular shady coding practice? Could point to a race between two threads that is only lost when the threads actually run on two CPUs. libc_r switches between threads on a single processor, where libthr and libpthread allow multiple threads to execute at once. -- Dan Nelson dnelson@allantgroup.com