After reading through this I now understand how to synchronize thread's critical sections on the native side of the JNI.
However, I cannot find equivalent functions for these 2 pthread calls: pthread_cond_timedwait() and pthread_cond_broadcast()
I have a long-running response-handler thread that is started in Java and then drops down into C to receive network data and then enqueue the data to a global shared response queue.
Concurrently I have multiple request threads that are started in Java and then drop down into C that issue network requests to a server and then wait for a response to show up on the global shared response queue.
The pertinent code in the long-running response thread is:
/* after enqueuing a network response to the global shared Q */
/* wake up all of the request threads waiting for a response */
pthread_cond_broadcast(&q_entry_cv);
And the pertinent code in the request threads:
if(q_entries == 0)
pthread_cond_timedwait(&q_entry_cv, &qlock, &ts);
/* wake up when the response thread has q'd a new response & search the q*/
Are there any equivalent JNI calls for these POSIX calls?