This is the mail archive of the java-discuss@sourceware.cygnus.com 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]

Re: Newbie question...


>>>>> "Simon" == Simon Gornall <simon@unique-id.com> writes:

Simon> Could anyone shed any light on whether it's possible to get a
Simon> threaded java program compiled under Linux as a native
Simon> executable ?

Yes it is possible.  I do it daily.

Simon> I configured egcs with 

Simon> configure --prefix=/opt/egcs
Simon>   --with-local-prefix=/opt/egcs
Simon>   --with-gxx-include-dir=/opt/egcs/include/g++
Simon>   --enable-shared
Simon>   --enable-threads
Simon>   --enable-languages=c++,f77,java,objc

Specifying `--enable-threads' is the same as `--enable-threads=no'.
I find this confusing, but I don't have the time to take it up with
the egcs developers.

Use --enable-threads=posix instead.

You want to configure egcs with the right --enable-threads value in
order to get threadsafe exception handling.

Simon> ... and libgcj with

Simon> configure --prefix=/opt/egcs
Simon>   --enable-threads=posix
Simon>   --enable-fast-character

This looks right.

Simon> Basically the problem appears to be that the code:
Simon>             try
Simon>                 {
Simon>                 Thread.sleep(10000);
Simon>                 }
Simon>             catch (Exception e)
Simon>                 {
Simon>                 System.err.println("Exception : " +e);
Simon>                 }
Simon>    ... just falls straight through the Thread.sleep() call...

There's a known bug in this code.  Thread.sleep() (at least on Linux,
with POSIX threads) doesn't actually sleep.

I haven't had a chance to debug this :-(

Tom

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