Function call macros: fix GIL not released
Closes #629 (closed)
The bug described in the issue above was caused by calling cppTango Device_XImpl functions while holding the GIL. These functions may acquire the DeviceLock, which in this case was already held by another thread that needed the GIL to proceed, resulting in a deadlock until timeout. This is more deeply described in the issue comment.
Also there was question if I could create tests to prevent such bug in the future but I see some problems in this:
- The bug is cased by inappropriate GIL handling in the C++ and the only tests I found are already in Python so I'd need to try create a timeout.
- To do this predictably I'd need to override problematic functions.
- Overriding problematic functions 'fixes' the bug as we don't use C++ fallback when Python one is found.
Also, this bug is unlikely to reappear again in the future, as the fix modifies the macros directly. In addition, I have left warn comments for each macro that acquires GIL for the scope in which it is used when it doesn't end with a return statement.
Edited by Szymon Kupiecki