Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 8958 invoked from network); 21 Nov 2006 11:28:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Nov 2006 11:28:34 -0000 Received: (qmail 39172 invoked by uid 500); 21 Nov 2006 11:28:40 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 39130 invoked by uid 500); 21 Nov 2006 11:28:39 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 39115 invoked by uid 99); 21 Nov 2006 11:28:39 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Nov 2006 03:28:39 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of alexey.v.varlamov@gmail.com designates 66.249.82.230 as permitted sender) Received: from [66.249.82.230] (HELO wx-out-0506.google.com) (66.249.82.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Nov 2006 03:28:26 -0800 Received: by wx-out-0506.google.com with SMTP id h29so2149553wxd for ; Tue, 21 Nov 2006 03:28:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=K3I/KeAv1BI/glGuCPziJWd7ukjO0vAjEwvuWN6JbtcQdp2I0K+wVioEdg54qYhjKJqWDLtbIUmGastN56/f8P1DLdMDm6Xu10p1ZrefTLGbqOk7D+45qA660yvn45Kdf/K85OkiAiATUSeGzQoQYdmJqWDTSl7/Ph0CmaNx+ss= Received: by 10.70.80.14 with SMTP id d14mr115095wxb.1164108485559; Tue, 21 Nov 2006 03:28:05 -0800 (PST) Received: by 10.70.23.14 with HTTP; Tue, 21 Nov 2006 03:28:05 -0800 (PST) Message-ID: Date: Tue, 21 Nov 2006 17:28:05 +0600 From: "Alexey Varlamov" To: dev@harmony.apache.org Subject: Re: [drlvm][shutdown] How to cleanup resources safely? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org [snip] > Java threads: We have much more control other java threads. Namely it > is possible to unwind the stack in a safe way. When the VM needs to > stop a java thread it asynchronously raises an exception to that > thread. The VM ensures that the exception will not be caught by any > java exception handler (ala j.l.ThreadDeath exception). This guarantee > full and safe java stack unwinding. If there is no user native frames > on the stack (JNI calls) then thread exits normally otherwise the > control is returned to the user's code with an exception raised. It is > the user's responsibility to handle exception properly and clean up > all resources allocated by native code. This part looks a bit contradictory: on the one hand, "VM ensures the exception will not be caugth", and on the other "control is returned to user's code with the exception raised". I presume you made a slip on the last and actually meant we can unwind safely and free stack-related VM resources; but then we should postpone shutdown hooks/finalizers until no other Java threads running including daemons? Other paragraphs look super, well-though. Great job! > > Any suggestions/comments are HIGHLY welcome. > > Thanks > Evgueni >