title: How to convert c++ multi-thread code to javascript?
body: <p>I have a multi-thread c++ code. I want to convert it to javascript file</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;pthread.h&gt;
  
  using namespace std;
  
  #define NUM_THREADS 5
  
  void *PrintHello(void *threadid) {
     long tid;
     tid = (long)threadid;
     cout &lt;&lt; "Hello World! Thread ID, " &lt;&lt; tid &lt;&lt; endl;
     pthread_exit(NULL);
  }
  
  int main () {
     pthread_t threads[NUM_THREADS];
     int rc;
     int i;
  
     for( i = 0; i &lt; NUM_THREADS; i++ ) {
        cout &lt;&lt; "main() : creating thread, " &lt;&lt; i &lt;&lt; endl;
        rc = pthread_create(&amp;threads[i], NULL, PrintHello, (void *)i);
  
        if (rc) {
           cout &lt;&lt; "Error:unable to create thread!!!" &lt;&lt; rc &lt;&lt; endl;
           exit(-1);
        }
     }
     pthread_exit(NULL);
  }
  </code></pre>
  
  <p>I use emscripten to to convert it to html</p>
  
  <pre><code>em++ test.cpp -o test.html
  </code></pre>
  
  <p>then I use firefox/chrome to open it. There is an error to create the thread.</p>
  
  <p>My question is does js support c++ multi-thread code? </p>