I think you're better off with writing the C code you want to run as function that you call from within Python.
The function will have the global interpreter lock (GIL) acquired during the call, so other Python threads cannot run, effectively pausing Python.
On 22.02.2013 13:59, Тушев Сергей wrote:
Hello! Tell me please, Is there any possibility to pause/resume the work of embedded python interpreter in place, where I need? For example: C++ pseudo-code part: main() { script ="python_script.py"; ... RunScript(script);//-- python script runs till the command 'stop' while(true){ //... read values from some variables in python-script //... do some work ... //... write new value to some other variables in python-script ResumeScript(script);//-- python script resumes it's work where// it was stopped. Not from begin! } ... } Python script pseudo-code part: #... do some init-work whiletrue: #... do some work stop # - here script stops and C++-function RunScript() # returns control to C++-part #... After calling C++-function ResumeScript # the work continues from this line Is this possible to do with Python/C API? Thanks
capi-sig mailing list capi-sig@python.org http://mail.python.org/mailman/listinfo/capi-sig
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, Feb 24 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/