Message169310
Sorry, Mark. Is not for associating thread state specified by embedding application. In simple terms it is exactly like existing PyGILState_Ensure() in that caller doesn't have a thread state, whether it has already been created. Only difference is to allow that simplified API to work against a sub interpreter.
Nick, I previously said:
"""In the case of the latter, if a Python thread is created in a specific sub interpreter, it should automatically designate for that thread that that is its interpreter context, so if it calls out and does the Release/Ensure dance, that it goes back into the same sub interpreter."""
So yes to your:
"""Thinking about it, I believe there still needs to be a concept of an "active thread state" TLS key in order to deal with Graham's original problem. Specifically, if PyGILState_EnsureEx is used to associate the thread with a particular interpreter, then subsequent calls to PyGILState_Ensure from *that thread* should get the explicitly associated interpreter, rather than the main interpreter."""
My example was more to do with a thread created in Python then calling out and back in, but same deal as foreign thread calling in, out and back in.
Antoine, yes, can possibly can be simplified to that. The original idea of a switch interpreter function was suggested on basis that PyGILState_Ensure would not be modified or extended version of function created. Rolling an implicit switch interpreter into PyGILState_EnsureEx when argument is different to the current may serve same purpose. |
|
Date |
User |
Action |
Args |
2012-08-28 22:10:13 | grahamd | set | recipients:
+ grahamd, mhammond, ncoghlan, pitrou, asvetlov |
2012-08-28 22:10:13 | grahamd | set | messageid: <1346191813.13.0.60126446433.issue15751@psf.upfronthosting.co.za> |
2012-08-28 22:10:12 | grahamd | link | issue15751 messages |
2012-08-28 22:10:12 | grahamd | create | |
|