[cp-patches] FYI: Handle thread state

Andrew John Hughes gnu_andrew at member.fsf.org
Thu Jun 29 21:02:22 UTC 2006


On Thu, 2006-06-29 at 10:33 +0200, Jeroen Frijters wrote:
> Andrew John Hughes wrote:
> > This patch puts a bit more into thread state handling.
> 
> I apologize for being blunt, but this patch is unacceptable. It doesn't
> cover all cases, it's incorrect and inefficient.
> 
> I really think it's best to leave determining the thread state up to
> VMThread, except of course that there still needs to be support for
> threads that don't yet (or no longer) have a VMThread.
> 
> Below is a patch that shows what I think getState should look like.
> 
> Regards,
> Jeroen
> 
> Index: java/lang/Thread.java
> ===================================================================
> RCS file: /cvsroot/classpath/classpath/java/lang/Thread.java,v
> retrieving revision 1.26
> diff -u -r1.26 Thread.java
> --- java/lang/Thread.java	27 Jun 2006 21:57:29 -0000	1.26
> +++ java/lang/Thread.java	29 Jun 2006 08:30:11 -0000
> @@ -1239,7 +1239,11 @@
>    public String getState()
>    {
>      VMThread t = vmThread;
> -    return t == null ? null : t.getState();
> +    if (t != null)
> +      return t.getState();
> +    if (group == null)
> +      return "TERMINATED";
> +    return "NEW";
>    }
>  
>    /**
> 
Committed as:

2006-06-29  Jeroen Frijters <jeroen at sumatra.nl>

        * java/lang/Thread.java:
        (getState()): Handle case of no VMThread
        correctly.

-- 
Andrew :-)

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20060629/538d8737/attachment.pgp


More information about the Classpath-patches mailing list