title: Android ADB Tool, 'fork' doesn't work
body: <h2>Environment</h2>
  <ul>
  <li>Android 5.0 @ Samsung Galaxy 5</li>
  <li>ADB @ Windows (x64)</li>
  <li>Native ADB Commandline tool</li>
  </ul>
  <h2>Use-case</h2>
  <p>An application that forks and immediately exit</p>
  <h2>Problem description</h2>
  <p>While fork returns a propper pid_t of the newly created process, no actual process is being created, ( <em>'adb -d shell ps | findstr shell'</em> shows no new process )</p>
  <h2>Code snippet</h2>
  <pre><code>__android_log_print(ANDROID_LOG_INFO, &quot;ScreenCapSvc&quot;, &quot;\n&quot;);
  pid_t pid = fork();
  __android_log_print(ANDROID_LOG_INFO, &quot;ScreenCapSvc&quot;, &quot;STARTED, pid = %d\n&quot;, pid);
  if (0 != pid)
      return S_OK;// Exits the parent process
  HRESULT hr;
  __android_log_print(ANDROID_LOG_INFO, &quot;ScreenCapSvc&quot;, &quot;Initializing\n&quot;);
  if (FAILED(hr = Initialize(pBaseAddress, wPort, uiMaxMessageSize)))
      return hr;
  __android_log_print(ANDROID_LOG_INFO, &quot;ScreenCapSvc&quot;, &quot;Running modal loop\n&quot;);
  hr = m_spIOCP-&gt;DoModal();
  OnCleanup(hr);
  __android_log_print(ANDROID_LOG_INFO, &quot;ScreenCapSvc&quot;, &quot;STOPPED, pid = %d\n&quot;, pid);
  return S_OK;
  </code></pre>
  <h2>Logcat output</h2>
  <pre><code>I/ScreenCapSvc(29062):
  I/ScreenCapSvc(29062): STARTED, pid = 29064
  </code></pre>
  <h2>Additional info</h2>
  <p>If rather them immediately exiting the parent process I call eg. sleep(2) than the child process is properly forked, HOWEVER, While the parent process actually terminate, 'ADB -d shell' never exit ( stays hanging infinity ).</p>
  <p><strong>Related link:</strong> <a href="https://stackoverflow.com/questions/28277361/android-adb-tool-c11-stdthread-usage">https://stackoverflow.com/questions/28277361/android-adb-tool-c11-stdthread-usage</a> <br />
  <br />
  What am I doing wrong? why does the process doesn't fork?</p>