Stephen Wynne <[EMAIL PROTECTED]> writes:
> In message <[EMAIL PROTECTED]>, Bernd Kreimeier writes:
>
> In case you missed it on the list - Juergen Kreileder just told me
> that JNI can't work with green_threads under Linux, if you use
> certain system calls like open(). I just checked the FAQ as he
> said it's "documented" - I had missed that so far.
>
> Bernd,
>
> Yes, I've been listening; I was just as surprised as you. So I just
> read the links you and Juergen mentioned, and consulted one other
> reference:
>
> [1] http://developer.java.sun.com/developer/bugParade/bugs/4040743.html
> [2] http://java.sun.com/docs/books/tutorial/native1.1/implementing/invo.html
> [3] "Essential JNI" by Rob Gordon, published 1998 by Prentice Hall PTR.
>
> I would like us to make a strong distinction at this point between
> straight JNI and the JVM Invocation API. JNI apparently isn't what's
> broken; the Invocation API is in some cases, namely yours and anyone
> else's who decides to do fairly normal things like "read, readv,
> write, writev, getmsg, putmsg, poll, open, close, pipe, fcntl, dup,
> create, accept, recv, send, and so on." [2]
Yes, it's the Invocation API.
> Rob Gordon suggests on [3] page 260 that:
>
> When building a Java-enabled application on Solaris and linking
> against the green threads version of libjava.so, you must defer system
> calls until after the call to JNI_CreateJavaVM. This is because the
> user-level threads package in libjava.so (green threads) defines its
> own system calls . . .
>
Without initializing the vm first, all overriden system calls will segfault.
But even with initializing the vm there are some strange side effects.
We have a big server application (http://eti.informatik.uni-dortmund.de) that
works with native threads and shows very strange behauviour with green threads.
> Also, I'm wondering if you've had any luck with this advice:
>
> The first step toward getting this to work is always to link
> libjava.so into the executable *first*, even before libc.so . . . [1]
>
> When some of this gets clearer, I'll update the FAQ. Thanks for your
> help and suggestions!
>
> Steve
Jürgen
--
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802