title: Android killing sub process from c++ fails
body: <p>My java code makes jni call to a c++ function (function0); the c++ code then starts a process:</p>
  
  <pre><code>int main_pid,new_process_pid=-1;
  void function0(){
      main_pid=getpid();
      new_process_pid=fork();
      if(main_pid!=getpid()){
          main_process();//some process with its own threads
      }
  }
  
  void kill_sub_process(){
      if(new_process_pid!=-1){
          kill(new_process_pid,SIGKILL);
      }
  }
  </code></pre>
  
  <p>when i try to kill the sub process by making a call from my activity onStop() to kill_sub_process function the following error shows up in logcat and the app crashes:</p>
  
  <blockquote>
    <p>Fatal signal 4 (SIGILL), code 1, fault addr 0x91cb3110 in tid 3844 </p>
  </blockquote>
  
  <p>what is the proper way to kill a sub process safely?</p>
  
  <p>the process gets killed without any problems when i call the signal handler from inside the sub process but fails when the parent sends the signal;</p>