aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Thread not starting after calling Java method from C Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Thread not starting after calling Java method from C" Watch "Thread not starting after calling Java method from C" New topic
Author

Thread not starting after calling Java method from C

Eric Kis
Greenhorn

Joined: Oct 25, 2012
Posts: 1
Hey guys,

So I'm having some trouble with my code. It works, but not in the way I want it to work. Here is the scenario:

A user clicks (CTRL+1). My C-code will register this sequence and pass a variable to a Java method. [Note: I needed to use C here since my program is designed to run while a full-screen game is running as well. Java would not be able to register the key-events without focus.] The Java method will start a new Thread which will count down. Once a certain amount of time has elapsed, the Java Thread will play a sound clip to the user.

This all works. The problem is, I want to be able to start multiple Threads (not at the same time, though). So, while one Thread could be counting down, another one or two or three could also be counting down. I can get one thread to start, but no new threads will start until the first one is complete. In fact, no key sequences are even registered once a Thread has been started. Following is the C code and partial Java code.

main.cpp



startJava.c



Timer.java (starts new thread)



Here's the actual run()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread not starting after calling Java method from C