This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

java.lang.Thread.start() doesn't work?


I'm running on the latest cvs-checkout on x86 linux. (one day old)

I can compile and run rather large and complex java-programs with gcj, 
but :

I can't make java.lang.Thread.start() work!

Here is an trivial example (More or less copied from the jdk1.3.1 
javadoc on java.lang.Thread :

 >>>

public class TestThread extends Thread
{
    public TestThread()
    {
    }
   
    public synchronized void start()
    {
    super.start();       
    }

    public void run()
    {
       for (int i=0; i<1000000000; i++) { if (i%10000000==0) 
System.out.print("."); }
    }
   
    public static void main(String args[])
    {
        TestThread p = new TestThread();
        new Thread(p).start();
    }
   
}

<<<

Needless to say, this code runs fine with sun jdk.

Compiled with gcj using :

gcj  TestThread.java  --main=TestThread


When running the resulting binary it produces the following output :

Exception in thread "main" java.lang.InternalError: Thread.start called 
but threads not available
   at 0x40266270: java.lang.Throwable.Throwable(java.lang.String) 
(/usr/local/lib/libgcj.so.3)
   at 0x402551f6: java.lang.Error.Error(java.lang.String) 
(/usr/local/lib/libgcj.so.3)
   at 0x40266606: 
java.lang.VirtualMachineError.VirtualMachineError(java.lang.String) 
(/usr/local/lib/libgcj.so.3)
   at 0x40257396: 
java.lang.InternalError.InternalError(java.lang.String) 
(/usr/local/lib/libgcj.so.3)
   at 0x403d4928: _Jv_ThreadStart(java.lang.Thread, int, void 
()(java.lang.Thread)) (/usr/local/lib/libgcj.so.3)
   at 0x40247f51: java.lang.Thread.start() (/usr/local/lib/libgcj.so.3)
   at 0x0804906e: ?? (/home/gb/rpm/BUILD/glibc-2.2.4/csu/init.c:0)
   at 0x4023c728: gnu.gcj.runtime.FirstThread.call_main() 
(/usr/local/lib/libgcj.so.3)
   at 0x402c5268: gnu.gcj.runtime.FirstThread.run() 
(/usr/local/lib/libgcj.so.3)
   at 0x40247ebc: _Jv_ThreadRun(java.lang.Thread) 
(/usr/local/lib/libgcj.so.3)
   at 0x40221464: _Jv_RunMain(java.lang.Class, byte const, int, byte 
const, boolean) (/usr/local/lib/libgcj.so.3)
   at 0x4022158d: JvRunMain (/usr/local/lib/libgcj.so.3)
   at 0x08048dd4: ?? (/home/gb/rpm/BUILD/glibc-2.2.4/csu/init.c:0)
   at 0x40609280: __libc_start_main (/lib/libc.so.6)
   at 0x08048cb1: _start (??:0)

Since java.lang.Thread is in libgcj, I would expect this code to work?

/Lars Andersen 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]