Kok Choon Kiat wrote:

It appears to me that the native thread has *seized the entire flow of control* from java program and it is not running independently. Why is that so? How can I make the native thread independent and not seize the flow of control from the java program? I would really appreciate if you can my answer my questions. Thank you very much.



Add a "System.exit( 0 );" to the end of your main() method.

When main() ends, all that means is that that thread has finished. If your process has other (non-daemon) threads running, it will continue to run until they finish, also. Unless you hard-terminate the process.

If you're trying to prove a point, you could add a random sleep in before calling System.exit(0), then you'd see nondeterminism at work and could be happy that it was doing what you wanted.

On the other hand, if what you're after (and I can't tell from your email, sorry), is that the "Hello World"'s keep printing even after the java process has exited, you need a Runtime.exec() or fork(), not a pthread_create(). I suspect you know this, but thought I'd throw it in just in case.

HTH

- Paul


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



Reply via email to