On Thu, May 18, 2000 at 10:15:08AM +0700, yangyuex wrote:
> Thanks very much!
>
> What's your mean:
>
> "which BTW
> sets *INTERRUPTED* flag in the Thread object,
> The use of the an instance variable is redundant since the thread
> already has
> a flag designed for that perpose."
>
> I also think this is a feasible way.
> Because I think the root for garbage collection are
> implementation-dependant.
> Depending on the implementation and support for native methods,
> roots for garbage collection may be contained in:
>
> o All pointers in all stack frames of the stacks of all JVM threads.
> These include pointers in the local variable areas of the frames
> and pointers in the operand stacks of the frames.
>
> o All pointers to static fields of classes in the class and method
> area of the JVM.
>
> o native methods,
Native methods themselves do not provide roots, but the JNI interface
does define semantics for effectively adding objects involved in a JNI
invocation to the root set.
> o registers of the JVM (for optimization)
Well the JVM doesn't really have registers, it's just got a stack. ;-)
Seriously though, a lot of JVM's use conservative GC which makes it
possible for objects to be marked as reachable despite the fact that
they aren't.
> From here, I think there is no way for the GC to collect an alive thread
> although there is no reference refer to it.
Actually, if a thread is still alive there is still a pointer to it,
otherwise, how could the Thread.enumerate() find it? ;-)
> So, by interrupt method here, which force run() method to finish, which
> is a safe way to make the thread dead.
--Chris
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]