ImageEngine/gaffer — pull request #892 by johnhaddon (2014-06-30 21:42:06+00:00)
Title: IPR shutdown deadlock fix

This fixes the deadlock reported in #855, using the changes from this Cortex pull request.

https://github.com/ImageEngine/cortex/pull/299

The problem was triggered when the deletion of a ScriptNode from python triggered the deletion of the InteractiveRenderManRender node, with the GIL still being held by the main thread. Deleting the render node caused RiEnd to be called, and 3delight would flush buckets to the display drivers and close them on one of the render threads. This would then try to enter Python as the display drivers signalled they had new data - but since the GIL was held on the main thread, deadlock ensued.

The Cortex change means that the GIL is released when deleting C++ objects, allowing our background threads to acquire it during renderer shutdown.