changes to duchain lock: can anybody reproduce this speedup?
Sven Brauch
mail at svenbrauch.de
Sat Jul 16 01:48:14 UTC 2016
Sorry, broken patch file, here it is again.
-------------- next part --------------
diff --git a/language/duchain/duchainlock.cpp b/language/duchain/duchainlock.cpp
index aa842ce..12f2ef6 100644
--- a/language/duchain/duchainlock.cpp
+++ b/language/duchain/duchainlock.cpp
@@ -26,6 +26,9 @@
#include <QThreadStorage>
#include <QElapsedTimer>
+#ifdef Q_OS_LINUX
+#include <sched.h>
+#endif
///@todo Always prefer exactly that lock that is requested by the thread that has the foreground mutex,
/// to reduce the amount of UI blocking.
@@ -94,7 +97,7 @@ bool DUChainLock::lockForRead(unsigned int timeout)
while (d->m_writer.loadAcquire()) {
if (!timeout || t.elapsed() < timeout) {
- QThread::usleep(uSleepTime);
+ sched_yield();
} else {
//Fail!
d->changeOwnReaderRecursion(-1);
@@ -149,7 +152,7 @@ bool DUChainLock::lockForWrite(uint timeout)
}
if (!timeout || t.elapsed() < timeout) {
- QThread::usleep(uSleepTime);
+ sched_yield();
} else {
//Fail!
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160716/1fadc255/attachment.sig>
More information about the KDevelop-devel
mailing list