Details
-
Type:
Epic
-
Status: Open
-
Priority:
P3: Somewhat important
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Core: Threads, Other
-
Labels:None
-
Epic Name:qYieldCpu()
Description
Thiago Macieira recently merged the addition of an _mm_pause() in a tight compare-and-swap loop in QFutureInterface: https://codereview.qt-project.org/c/qt/qtbase/+/407431
He links to various sources that detail why that is a good idea.
But we have many such loops in Qt, and adding that Q_PROCESSOR #ifdef'ery is making the code ugly. And besides, ARM has the YIELD instruction, which is serving the same purpose.
So, we need to have a function, say qYieldCpu(), to encapsulate all this, and then roll this out to other CAS loops, too.