Now handling the GIL in all the necessary places. Also rendering the held ParameterisedProcedural immediately rather than with a Renderer::procedural call. This is slightly faster, but more importantly avoids a deadlock that could occur when the draw call for the procedural holder was directly caused by a python call (e.g. currentTime). In this case maya would be holding the GIL on the same thread that did the draw. When the procedural was spawned in a separate thread this thread would then be unable to get the GIL. We couldn't simply release the GIL from the scene() method, as the GIL wasn't always held on that thread (the draw call could originate from somewhere other than python). Attempted to make ScopedGILRelease work (silently do nothing) when used from a thread without the GIL, but couldn't see a way of determining if the current thread held the GIL using the public python C api. PyThreadState_IsCurrent is the function we need but it has been deliberately not exported.
Now handling the GIL in all the necessary places. Also rendering the held ParameterisedProcedural immediately rather than with a Renderer::procedural call. This is slightly faster, but more importantly avoids a deadlock that could occur when the draw call for the procedural holder was directly caused by a python call (e.g. currentTime). In this case maya would be holding the GIL on the same thread that did the draw. When the procedural was spawned in a separate thread this thread would then be unable to get the GIL. We couldn't simply release the GIL from the scene() method, as the GIL wasn't always held on that thread (the draw call could originate from somewhere other than python). Attempted to make ScopedGILRelease work (silently do nothing) when used from a thread without the GIL, but couldn't see a way of determining if the current thread held the GIL using the public python C api. PyThreadState_IsCurrent is the function we need but it has been deliberately not exported.

code-google-com/cortex-vfx,code-google-com/cortex-vfx,ruschelp/cortex-vfx,code-google-com/cortex-vfx,code-google-com/cortex-vfx,ruschelp/cortex-vfx,ruschelp/cortex-vfx