All,

I have been working with a snapshot dated 8/4/00 and have hit three bugs in
java.lang.Thread.  If the following mods have already been made, please
ignore this email.

java.lang.Thread.<init>(ThreadGroup group, Runnable toRun, String name) does
not appear to
set a useful default value for the name field.  The following diff sets it:

< 
203c203,208
<               this.name = name;
---
>               if ( this.name == null )
>               {
>                       String ss = "Thread-" + (++numThreadsCreated);
>                       this.name = ss;
>               }

Also, public final void join(long ms, int ns) appears to have reversed the
sense of the isAlive() test.  This results in race conditions when
multithreaded apps try to synch via a join() statement.  Diffs for this are
included below:

360c365,366
<                       while(!isAlive())
---
>                       while(isAlive())
364c370,371
<                               if(isAlive())
---
>                               if(!isAlive())


The method called public String toString() returns null which results in a
println(thr_obj) that prints nothing.  The below diff sets it to the name
field instead:

514c521
<               return "";
---
>               return this.name;

Finally, the current java.lang.Thread does not appear to make it easy to
associate an internal VM thread block with a java Thread object.  This could
be easily solved by adding the following field to the beginning of the
class.  For example:

public class Thread {
        private Object data;
...
...
...

Thanks,
        Weldon Washburn
        Intel

Reply via email to