title: WebAssembly pthreads
body: <p>I spent 2 days on compiling my C++ project with enabled pthreads via emscripten to WASM without success.</p>
  <p>It compiles fine. I used options -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4.</p>
  <p>But when I execute my index.html via &quot;emrun index.html&quot; - it even doesn't reach main function and stuck on pthreads pool preallocation:
  pthread sent an error! undefined:undefined: undefined</p>
  <p>Obviously if I don't specify pthreads pools - it starts my main function but throws the same error when I reach pthread creation in my code.</p>
  <p>Unfortunately I didn't find any answers in the google related to this problem.
  I run this in my browser: <a href="https://alex-wasm.appspot.com/threads/index.html" rel="nofollow noreferrer">https://alex-wasm.appspot.com/threads/index.html</a>
  And it reports that browser fully supports pthreads in WebAssembly.</p>
  <p>Today I found example WASM project which is used pthreads but surprisingly when I start it with emrun I get exactly the same pthreads error in the console.</p>
  <p>After this I tried to run it without emrun and got different error:</p>
  <p>Uncaught DOMException: Failed to construct 'Worker': Script at 'file:///D:/engine/src/main/Emscripten/wengine.worker.js' cannot be accessed from origin 'null'.
  at Object.allocateUnusedWorker (file:///D:/engine/src/main/Emscripten/wengine.js:2221:36)
  at Object.initMainThreadBlock
  ...</p>
  <p>I get the same error in both my project and example project when I run without emrun...</p>
  <p>P.S. I need emrun to access my files without deploying the project on the server (for fast debugging).</p>
  <p>So can you please give me the hints for this 2 questions:</p>
  <ol>
  <li>Is it possible to run webassembly build with pthreads support using emrun?</li>
  <li>Why it doesn't work even without emrun with this Uncaught DOMException ?</li>
  </ol>