|
From: Ganesh K. <kum...@ic...> - 2014-03-31 16:48:04
|
I would like to insert a piece of code (say a crosscutting c++ function call) before the actual method invocations in the swig generated wrapper code in all wrapper functions. I have used the %exception directive in my .i file and ended up getting the following wrapper code generated.
some_crosscutting_c++_function_call();
try {
{
SWIG_PYTHON_THREAD_BEGIN_ALLOW;// release GIL
actual_c++_function_call();
SWIG_PYTHON_THREAD_END_ALLOW;// acquire GIL
}
}
catch(some exception) {
......
}
But what I want is the following
try {
{
SWIG_PYTHON_THREAD_BEGIN_ALLOW;//release GIL
some_crosscutting_c++_function_call();
actual_c++_function_call();
SWIG_PYTHON_THREAD_END_ALLOW;//acquire GIL
}
}
catch(some exception) {
......
}
The crosscutting function call doesn't need GIL, hence I want it to be called after the GIL is released. Is there a way to have a hook just before actual_c++_function_call() and after SWIG_PYTHON_THREAD_BEGIN_ALLOW ?
Any help would be deeply appreciated.
Thanks
|