From owner-freebsd-threads@FreeBSD.ORG Tue Feb 3 06:43:36 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 290D31065673 for ; Tue, 3 Feb 2009 06:43:36 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 18C928FC12 for ; Tue, 3 Feb 2009 06:43:36 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from apple.my.domain (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n136hXjR014857 for ; Tue, 3 Feb 2009 06:43:34 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4987E818.9010309@freebsd.org> Date: Tue, 03 Feb 2009 14:45:44 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20080612) MIME-Version: 1.0 To: freebsd-threads@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: pthread_exit() and stack unwinding, do you need it ? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2009 06:43:36 -0000 Hi, This patch had been done in free time when I found nothing to do, it is used for unwinding stack before thread really exits. patch: http://people.freebsd.org/~davidxu/patch/unwind.patch test cases: http://people.freebsd.org/~davidxu/patch/unwind_test.tgz The feature implemented here is that C++ and other languages need to destruct on-stack objects, the current pthread_exit() does not know the knowledge and when thread exits, they may cause resource leaks not freed by their objects. This patch has not been tested for enough long time, I am also not a such binary-level expert, I will be glad to see experts come in and continue the work, as other OSes have already implemented this feature. However, I see this as an enhanced feature, and it is not a must-have feature. It is left to people to determine whether we need it or not. Regards, David Xu