you can only access python from 1 thread at a time. I have not done any messing around with python types so I do not know if those require the gil but from what you said it seems like they may. In order to work with python from multiple threads you need to manage the gil in your app. Just do a search on this list for gil and you will get all the information you need. In the C api, I think the functions to look into are PyGILState_Ensure and PyGILState_Release.
On Sun, Jun 6, 2010 at 7:00 PM, Embhi Karuche <embhi.karu...@gmail.com>wrote: > >No you can do this, I do the same thing in my project. > >However, without appropriate GIL locks your new thread cannot call into > >python. So make sure your new thread of not calling any python callables > >and you are fine. > > In my worker thread (ie, the workCallback() which is invoked by the > doHeavyWork()), I was merely appending to a boost::python::list. I > stopped doing that and my problems seem to have gone.. I think. > > so are you saying that I cant even access "basic" python objects like > python::str python::list from another thread?? > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig >
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig