aboutsummaryrefslogtreecommitdiffstats
path: root/generator/cppgenerator.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-04-06 22:50:56 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:20 -0300
commit6ea5f0caa16f783d50221f817431d2cadc22f947 (patch)
tree8620c3da1dcc7695c689b874d8e5559420330797 /generator/cppgenerator.cpp
parentf107f41c2b99517133ac4d2d624e8ee61cac2bb2 (diff)
Added the type system variables %BEGIN_ALLOW_THREADS and %END_ALLOW_THREADS.
Also moved the save and restore thread state lines to a macro in ShibokenGenerator header file. The type system variables documentation was updated accordingly. Reviewed by Lauro Moura <lauro.neto@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'generator/cppgenerator.cpp')
-rw-r--r--generator/cppgenerator.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index f208241b8..cef8523be 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -417,9 +417,9 @@ void CppGenerator::generateClass(QTextStream &s, const AbstractMetaClass *metaCl
s << INDENT << "const ::" << metaClass->qualifiedCppName() << "* cppSelf = ";
s << "Shiboken::Converter< ::" << metaClass->qualifiedCppName() << "*>::toCpp(pyObj);" << endl;
s << INDENT << "int result;" << endl;
- s << INDENT << "Py_BEGIN_ALLOW_THREADS" << endl;
+ s << INDENT << BEGIN_ALLOW_THREADS << endl;
s << INDENT << "result = !cppSelf->isNull();" << endl;
- s << INDENT << "Py_END_ALLOW_THREADS" << endl;
+ s << INDENT << END_ALLOW_THREADS << endl;
s << INDENT << "return result;" << endl;
s << '}' << endl << endl;
}
@@ -2161,7 +2161,7 @@ void CppGenerator::writeMethodCall(QTextStream& s, const AbstractMetaFunction* f
}
if (!injectedCodeCallsCppFunction(func)) {
- s << INDENT << "PyThreadState* _save = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS" << endl << INDENT;
+ s << INDENT << BEGIN_ALLOW_THREADS << endl << INDENT;
if (isCtor) {
s << "cptr = ";
} else if (func->type() && !func->isInplaceOperator()) {
@@ -2185,7 +2185,7 @@ void CppGenerator::writeMethodCall(QTextStream& s, const AbstractMetaFunction* f
s << " " CPP_RETURN_VAR " = ";
}
s << methodCall << ';' << endl;
- s << INDENT << "PyEval_RestoreThread(_save); // Py_END_ALLOW_THREADS" << endl;
+ s << INDENT << END_ALLOW_THREADS << endl;
if (!isCtor && !func->isInplaceOperator() && func->type()
&& !injectedCodeHasReturnValueAttribution(func, TypeSystem::TargetLangCode)) {