File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -703,5 +703,21 @@ fn rustworkx(py: Python<'_>, m: &Bound<PyModule>) -> PyResult<()> {
703703 m. add_class :: < iterators:: BiconnectedComponents > ( ) ?;
704704 m. add_class :: < ColoringStrategy > ( ) ?;
705705 m. add_wrapped ( wrap_pymodule ! ( generators:: generators) ) ?;
706+ #[ cfg( target_os = "emscripten" ) ]
707+ setup_rayon_for_pyodide ( ) ;
706708 Ok ( ( ) )
707709}
710+
711+ #[ cfg( target_os = "emscripten" ) ]
712+ static PYODIDE_INIT : std:: sync:: Once = std:: sync:: Once :: new ( ) ;
713+
714+ #[ cfg( target_os = "emscripten" ) ]
715+ pub fn setup_rayon_for_pyodide ( ) {
716+ PYODIDE_INIT . call_once ( || {
717+ rayon:: ThreadPoolBuilder :: new ( )
718+ . num_threads ( 1 )
719+ . use_current_thread ( )
720+ . build_global ( )
721+ . expect ( "failing setting up threads for pyodide" ) ;
722+ } ) ;
723+ }
You can’t perform that action at this time.
0 commit comments