Running 2 Python scripts concurrently with Boost Python embedded in C++ -
i embedded python in c++ using boost python.
i wanted run 2 python scripts concurrently. scripts should have opportunity access c++ member functions.
well, when use 1 thread in main interpreter can use member functions. run 2 scripts concurrently create new interpreter each thread (http://docs.python.org/2/c-api/init.html#sub-interpreter-support). scripts can executed concurrently not able use member functions.
this general problem.
pythreadstate* py_newinterpreter():
create new sub-interpreter. (almost) totally separate environment execution of python code. in particular, new interpreter has separate, independent versions of imported modules, including fundamental modules builtins, main , sys. table of loaded modules (sys.modules) , module search path (sys.path) separate. new environment has no sys.argv variable. has new standard i/o stream file objects sys.stdin, sys.stdout , sys.stderr (however these refer same underlying file descriptors).
so, there no possibility that?
Comments
Post a Comment