Thread not starting after calling Java method from C
posted 4 years ago
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.