From owner-freebsd-stable@FreeBSD.ORG Tue Nov 24 15:18:34 2009 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05F5A1065693 for ; Tue, 24 Nov 2009 15:18:34 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 7CA3E8FC19 for ; Tue, 24 Nov 2009 15:18:33 +0000 (UTC) Received: by bwz5 with SMTP id 5so6488938bwz.3 for ; Tue, 24 Nov 2009 07:18:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:to:subject:references :organization:from:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=ap+5IHbO//52lh0SmRF9Rgj85h9cJYG/FYI5Vuk46bQ=; b=VrN/YPOxwHYIMMdZbI6akeEBW4nojKD77CyVXvRd4jKim7tGYWgJkdoOGyXNFRBhbn TlN1xWFwwZcUj0uWSBd13Um4wi5xztFQObz4P0EWEJmSkVm0oom5w32FU9VrvP9Lmltr 8jKl3NIXFoGSECW0d3+d/tf9NjzyDqulvbvHw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=to:subject:references:organization:from:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=XyPXpD8UxJ9z1op1VuKvatQXOLTk/D84n9gVfQv9eW3Upz2L2PW2/3X1qv/bW0IgjV DX452K2ZfN3Mb7GhPbTJO0RxYnxIv+O1U45rhcMGwub9rWKxDR/nAZ2y6gXje/hFHAMM UMpM+NQ9hEoW9lQwA3cnm5f379XclNMSSjxzM= Received: by 10.204.20.142 with SMTP id f14mr343371bkb.64.1259075912035; Tue, 24 Nov 2009 07:18:32 -0800 (PST) Received: from localhost (ms.singlescrowd.net [80.85.90.67]) by mx.google.com with ESMTPS id 13sm1434861bwz.2.2009.11.24.07.18.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 24 Nov 2009 07:18:31 -0800 (PST) To: FreeBSD Stable References: <86aayc7z4g.fsf@zhuzha.ua1> Organization: TOA Ukraine From: Mikolaj Golub Date: Tue, 24 Nov 2009 17:18:29 +0200 In-Reply-To: <86aayc7z4g.fsf@zhuzha.ua1> (Mikolaj Golub's message of "Tue\, 24 Nov 2009 16\:53\:35 +0200") Message-ID: <8663907xyy.fsf@zhuzha.ua1> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: pthread.h: typo in #define pthread_cleanup_push/pthread_cleanup_pop X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2009 15:18:34 -0000 On Tue, 24 Nov 2009 16:53:35 +0200 Mikolaj Golub wrote: > Hi, > > I have problems with compiling our application under 8.0. > > It fails due to these definitions in pthread.h that look like a typo or > incorrectly applied patch: > > 170 #define pthread_cleanup_push(cleanup_routine, cleanup_arg) \ > 171 { \ > 172 struct _pthread_cleanup_info __cleanup_info__; \ > 173 __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ > 174 &__cleanup_info__); \ > 175 { > 176 > 177 #define pthread_cleanup_pop(execute) \ > 178 } \ > 179 __pthread_cleanup_pop_imp(execute); \ > 180 } > > > This patch fixes the problem for me: I was hurry when said that the patch fixed the problem. The application compiled but later it crashed in pthread_cleanup_pop: (gdb) bt #0 0xbf4f9ee0 in ?? () #1 0x287d18c9 in __pthread_cleanup_pop_imp () from /lib/libthr.so.3 #2 0x287d18ed in pthread_cleanup_pop () from /lib/libthr.so.3 #3 0x287d123c in pthread_exit () from /lib/libthr.so.3 #4 0x287c7757 in pthread_getprio () from /lib/libthr.so.3 #5 0x00000000 in ?? () So, I don't know what these macros actually were supposed to be. They were introduced in r179662: Revision 1.43: download - view: text, markup, annotated - select for diffs Mon Jun 9 01:14:10 2008 UTC (17 months, 2 weeks ago) by davidxu Branches: MAIN Diff to: previous 1.42: preferred, colored Changes since revision 1.42: +21 -2 lines SVN rev 179662 on 2008-06-09 01:14:10Z by davidxu Make pthread_cleanup_push() and pthread_cleanup_pop() as a pair of macros, use stack space to keep cleanup information, this eliminates overhead of calling malloc() and free() in thread library. Discussed on: thread@ > --- pthread.h.orig 2009-11-24 16:44:13.000000000 +0200 > +++ pthread.h 2009-11-24 16:44:45.000000000 +0200 > @@ -172,10 +172,10 @@ > struct _pthread_cleanup_info __cleanup_info__; \ > __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ > &__cleanup_info__); \ > - { > + } > > #define pthread_cleanup_pop(execute) \ > - } \ > + { \ > __pthread_cleanup_pop_imp(execute); \ > } -- Mikolaj Golub