PhysX: Let the thread wait for its creator on emscripten
PxThreadImpl::start() spins until the new thread has stored its TID.
With emscripten, a thread started from the browser's main thread only
runs once a worker is free in the pthread pool, or else once the main
thread has returned to the event loop. The default CPU dispatcher starts
QThread::idealThreadCount() workers, which on WebAssembly is
navigator.hardwareConcurrency, while Qt links with a pool of four, so on
any machine with more cores than that the main thread spins forever and
the page stays blank.
The PhysX 4.1 copy had a patch for exactly this, added for QTBUG-123888
in 1a57c386602548a22ce014ec909ae4db5ea36451 and dropped along with the
4.1 sources when PhysX was updated. Bring it back as patch 0019: on
emscripten start() marks the thread as started and releases it, and the
new thread waits for that before it runs. Nothing on emscripten needs
the TID, as the affinity calls do nothing there.
The 4.1 patch tested the macro with #ifdef, which PhysX always defines;
this one tests its value.
Amends 7533abcc02b7f9bd7953203c489ee86d55e8c909
Task-number: QTBUG-123888
Task-number: QTBUG-151206
Assisted-by: Claude Code
Change-Id: Ifc281ead60e88d23ce4da94b4d9d467819eb3ba9
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>