harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Varlamov" <alexey.v.varla...@gmail.com>
Subject Re: [drlvm][shutdown] How to cleanup resources safely?
Date Tue, 21 Nov 2006 11:28:05 GMT
> 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
Other paragraphs look super, well-though. Great job!

> Any suggestions/comments are HIGHLY welcome.
> Thanks
> Evgueni

View raw message