Replace existing calls to std::thread with platform threading primitives and set a stack quota to avoid stack overflows for some recursive use cases in js.