Hi,
    Using:
        Linux 2.2.9, Debian potato (glibc 2.1 - hence green threads),
with your jdk 1.2 pre-release-v1
I have a bit of a problem with JNI and a fairly complex program I'm in
the middle of writing. What it basically does is accept requests on a
specific network port, accepts clients (starts a new thread and passes
the socket (from accept()) to that thread) and gets all sorts of data
from the client to run a program written in fortran. Once it has all the
data it needs, the client can start the program.I'm using JNI to run a
small C program that grabs 3 parameters (1 = program name, 2 = first
parameter to pass to program, 3 = second parameter to pass to program).
It grabs those parameters from jstring into *char and fork()'s, the
child then execl()'s the fortran program with the specified parameters..

Now thats all fine and dandy and works nicely... The only problem is
that program runs for quite a long time and the client should be able to
detach while it's running, however if the client issues a request to
quit, the thread appears to end (I have a System.out.println() at the
very end of run() in my thread and it prints it!) but the socket doesn't
close -- I do a close() on my PrintWriter attached to the socket before
the end of run().
The socket closes if the fortran program isn't running, if it is
running, the socket stays open...
I've tried running a seperate thread that accepts commands to start
programs from a queue, so it's not started in the thread that has the
socket, but exactly the same thing happens.
I'm presuming this has something to do with garbage collection (?) or
something like that since the object is passed via JNI to my C program
which has it's image overlayed with the new fortran program at
execl()... But then again, I really don't know!
Is this something specific to Linux_JDK_1.2_pre-release-v1, or is it a
problem with the way I'm doing it? Can you suggest a better way to
fork() a new process?

If code samples would help I'll give them if you can tell me what you
need to see.
Thanks heaps! And thanks for the linux port, it rocks (apart from
this...).
 -- Roddy


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to