title: Stop Java thread which call JNI function
body: <p>Here I want to <em>stop my thread or kill my thread</em> which is created on Java layer, and this thread is calling JNI function. Sometimes as per my application requirement, I have to stop this <em>JNI function execution</em> on some conditions if its going on, otherwise not.</p>
  
  <pre><code>new Thread(new Runnable() {
      @Override
      public void run() {
           // My jni function call, It calls my JNI layer C function.
           }
     }
  </code></pre>
  
  <p>Now when this thread execution is started and its doing work at JNI level I have no worries about that, but from other class or methods on some condition I want to stop this JNI work so how can I stop this thread.</p>
  
  <p><strong>Note:</strong> Here my thread also has no while-loop so I cant check with some global flag variable also.</p>
  
  <p>So does anyone have an idea on how to kill a thread while its call any JNI function without while loop.</p>