[Python] Don't attempt to acquire the GIL in situations where we
know that it will already be locked. This avoids some dead-locks with mod_python (due to mod_python bugs which are apparently unlikely to ever be fixed), and results in smaller wrappers which run a little faster (in tests with Xapian on x86-64 Ubuntu 9.04, the stripped wrapper library was 11% smaller and ran 2.7% faster). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11192 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
60f0c7e56b
commit
38f00d3544
2 changed files with 9 additions and 23 deletions
|
|
@ -1739,7 +1739,6 @@ public:
|
|||
/* Last node in overloaded chain */
|
||||
|
||||
int maxargs;
|
||||
int allow_thread = threads_enable(n);
|
||||
|
||||
String *tmp = NewString("");
|
||||
String *dispatch;
|
||||
|
|
@ -1762,8 +1761,6 @@ public:
|
|||
Wrapper_add_local(f, "argc", "int argc");
|
||||
Printf(tmp, "PyObject *argv[%d]", maxargs + 1);
|
||||
Wrapper_add_local(f, "argv", tmp);
|
||||
if (allow_thread)
|
||||
thread_begin_block(n, f->code);
|
||||
|
||||
if (!fastunpack) {
|
||||
Wrapper_add_local(f, "ii", "int ii");
|
||||
|
|
@ -1780,19 +1777,8 @@ public:
|
|||
|
||||
Replaceall(dispatch, "$args", "self,args");
|
||||
|
||||
if (allow_thread) {
|
||||
String *ret = NewStringEmpty();
|
||||
thread_end_block(n, ret);
|
||||
Append(ret, "return ");
|
||||
Replaceall(dispatch, "return ", ret);
|
||||
Delete(ret);
|
||||
}
|
||||
|
||||
Printv(f->code, dispatch, "\n", NIL);
|
||||
|
||||
if (allow_thread)
|
||||
thread_end_block(n, f->code);
|
||||
|
||||
if (GetFlag(n, "feature:python:maybecall")) {
|
||||
Append(f->code, "fail:\n");
|
||||
Append(f->code, "Py_INCREF(Py_NotImplemented);\n");
|
||||
|
|
@ -1899,8 +1885,6 @@ public:
|
|||
kwargs = NewString("");
|
||||
|
||||
int allow_thread = threads_enable(n);
|
||||
if (allow_thread)
|
||||
thread_begin_block(n, f->code);
|
||||
|
||||
Wrapper_add_local(f, "resultobj", "PyObject *resultobj = 0");
|
||||
|
||||
|
|
@ -2331,8 +2315,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (allow_thread)
|
||||
thread_end_block(n, f->code);
|
||||
Append(f->code, " return resultobj;\n");
|
||||
|
||||
/* Error handling code */
|
||||
|
|
@ -2341,8 +2323,6 @@ public:
|
|||
if (need_cleanup) {
|
||||
Printv(f->code, cleanup, NIL);
|
||||
}
|
||||
if (allow_thread)
|
||||
thread_end_block(n, f->code);
|
||||
Printv(f->code, " return NULL;\n", NIL);
|
||||
|
||||
|
||||
|
|
@ -3858,10 +3838,8 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
|
||||
int allow_thread = threads_enable(n);
|
||||
|
||||
if (allow_thread)
|
||||
thread_begin_block(n, w->code);
|
||||
|
||||
if (allow_thread) {
|
||||
thread_begin_block(n, w->code);
|
||||
Append(w->code, "{\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue