diff options
author | Cristián Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2020-02-21 14:53:59 +0100 |
---|---|---|
committer | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2020-03-13 08:15:28 +0100 |
commit | ed7dd6ddeeea87ccd56be3c83be7dc3942d4ff57 (patch) | |
tree | 05948f15e68fb91cfb123197c1a90eb41d042832 | |
parent | 4106f1420119f77b41246836f1829431a1c58395 (diff) |
Change the default of allow-thread to false
This process introduced many unnecessary calls to
the Py_BEGIN/END_ALLOW_THREAD macro to PySide,
which had a negative impact on the overall behavior
when studying the responsiveness of UIs with threads.
Some tests were adapted to include the new allow-thread
behavior.
[ChangeLog][shiboken] The default of the "allow-thread" attribute
has been changed to false as it was observed to cause performance
issues when using threads.
Task-number: PYSIDE-803
Change-Id: I2cd67c86340f7bf7a2c5694869d17fe2027a0abb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
3 files changed, 10 insertions, 7 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp index 5ae671d87..0ce7df00a 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp @@ -819,9 +819,11 @@ bool AbstractMetaFunction::allowThread() const case TypeSystem::AllowThread::Allow: break; case TypeSystem::AllowThread::Auto: - case TypeSystem::AllowThread::Unspecified: result = autoDetectAllowThread(); break; + case TypeSystem::AllowThread::Unspecified: + result = false; + break; } if (!result) qCDebug(lcShiboken).noquote() << msgDisallowThread(this); diff --git a/sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp b/sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp index 922f1c23f..4fd4269f6 100644 --- a/sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp @@ -256,9 +256,9 @@ struct A { // Nothing specified, true const AbstractMetaFunction *f1 = classA->findFunction(QLatin1String("f1")); QVERIFY(f1); - QVERIFY(f1->allowThread()); + QVERIFY(!f1->allowThread()); - // 'auto' specified, should be true for nontrivial function + // 'auto' specified, should be false for nontrivial function const AbstractMetaFunction *f2 = classA->findFunction(QLatin1String("f2")); QVERIFY(f2); QVERIFY(f2->allowThread()); @@ -349,7 +349,7 @@ struct A : public Base { <object-type name='A'/> </typesystem>)XML") << false << false << false // exception - << true; // allowthread + << false; // allowthread // Modify one function QTest::newRow("modify-function1") @@ -363,7 +363,7 @@ struct A : public Base { </object-type> </typesystem>)XML") << false << false << true // exception - << true; // allowthread + << false; // allowthread // Flip defaults by modifying functions QTest::newRow("modify-function2") @@ -378,7 +378,7 @@ struct A : public Base { </object-type> </typesystem>)XML") << true << false << false // exception - << true; // allowthread + << false; // allowthread // Activate on type system level QTest::newRow("typesystem-on") @@ -428,7 +428,7 @@ struct A : public Base { </object-type> </typesystem>)XML") << true << false << false // exception - << true; // allowthread + << false; // allowthread } void TestModifyFunction::testScopedModifications() diff --git a/sources/shiboken2/doc/typesystem_manipulating_objects.rst b/sources/shiboken2/doc/typesystem_manipulating_objects.rst index c04a4fa27..f76289bc4 100644 --- a/sources/shiboken2/doc/typesystem_manipulating_objects.rst +++ b/sources/shiboken2/doc/typesystem_manipulating_objects.rst @@ -119,6 +119,7 @@ modify-function lengthy I/O operations or similar. It has performance costs, though. The value ``auto`` means that it will be turned off for functions for which it is deemed to be safe, for example, simple getters. + The attribute defaults to ``false``. The ``exception-handling`` attribute specifies whether to generate exception handling code (nest the function call into try / catch statements). It accepts |