classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Joining all non-daemon threads


From: Tom Tromey
Subject: Re: Joining all non-daemon threads
Date: 17 Sep 2001 17:30:43 -0600

>>>>> "Patrick" == Patrick Doyle <address@hidden> writes:

Patrick> What's the easiest way to implement this?  Does ThreadGroup
Patrick> provide enough functionality to do it?  Or do I have to
Patrick> maintain a list of active threads myself?  Does Classpath
Patrick> have any additional functionality to support this?

In libgcj we have a master thread which simply waits on a condition
variable.  When a new thread is started, an active thread count is
incremented.  When a thread dies, the count is decremented and the
master thread is notified.  If it finds that the count is zero, the VM
shuts down.  In our implementation ThreadGroup doesn't enter the
picture.  The work is all done by Thread.  You don't need a list of
all the active threads, just a count.  Also, I'd advise reading the
JNI invocation API documentation before starting this.

Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]