Hi Yicong, On Tue, Sep 8, 2015 at 1:35 PM, Yicong Huang <hengha....@gmail.com> wrote: > The process looks like: > Main process create thread pool -> thread 1 initialized Pypy-> thread 1 run > Python code -> thread 1 finish -> thread 1 finalize Pypy -> thread 2 > initialized Pypy -> thread 2 run Python code -> thread 2 finish -> thread 2 > finialize Pypy ...
It's most probably fine to do the following in the thread: * first, acquire a lock to make sure there are no race conditions * if pypy has not been initialized so far: * rpython_startup_code(); * pypy_init_threads(); * pypy_setup_home(...) * any other initialization, like pypy_execute_source_ptr() * else: * pypy_thread_attach(); * release the lock * call python code A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev