JNI and GNU and Solaris, oh my!

Hello,

I have a problem and I'm really hoping somebody can help me with it. I'm trying to get a Java program to work on Solaris, which uses JNI code compiled with the GNU gcc compiler. My Java program hangs, typically when it is trying to start a thread or check the state of a thread.

Does anyone know of any issues involved in building a Solaris shared object library using the GNU compiler?

Robert

[441 byte] By [rmm2] at [2007-9-26 5:27:07]
# 1
Are you starting the thread in the JNI code?There are special things that have to be done to do that.If instead all you are doing is calling your JNI methods from threads it would suggest that your JNI code is not thread safe.
jschell at 2007-6-29 19:35:38 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

I am starting my JNI code from a Java program. I found out the problem I was having was my JNI code was setting a signal handler. This did not cause any problems under SCO OpenServer but apparently the Sun implementation of the JVM needs SIGUSR2 left alone.

Another problem I'm having is that errno is not being set when a system call fails. Can someone tell me what is causing this and how to get around it?

Thanks!

Robert

rmm2 at 2007-6-29 19:35:38 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3

Hi !

At least on Linux you can get this problem if you have some multithreaded code that isn't compiled with -D_REENTRANT, I don't now if this is an issue any longer though, I havn't done this for some time.

When _REENTRANT isn't defined these is only one errno, the one for the main thread.

Mikael

mikael_aronsson at 2007-6-29 19:35:38 > top of Java-index,Java HotSpot Virtual Machine,Specifications...