concurrent.futures may be available but some functionality may not be available.
To more accurately check whether multithreading is available, attempt to start a new thread using a ThreadPoolExecutor.
numpy.org's REPL (backed by Pyodide which is wasm32-emscripten) allows the module to be imported, but submitting a task (which should start a new thread) fails with a RuntimeError.
Adds a class intended for processing lots of smaller CPU-bound tasks
that release the GIL. This class allows a function to be wrapped such
that calling the wrapper will schedule the wrapped function to be called
on another thread.
When multithreading is not available on the current system, the function
to wrap is returned instead, resulting in single-threaded execution, so
the calling code doesn't need to be aware of whether multithreading is
available.
The class starts its own threads as needed using a ThreadPoolExecutor
and a context manager is used to wait for its threads to shut down when
exiting the context.
Longer tasks, such as those which are IO related may be more suited to
using a ThreadPoolExecutor directly.
This patch on its own makes no changes to FBX import/export.