Added LocklessList and use it for new play handles #2895

Merged
merged 1 commit into from Jul 6, 2016

Projects

None yet

3 participants

@jasp00
Member
jasp00 commented Jul 3, 2016

This should fix #2886.

@jasp00
Member
jasp00 commented Jul 3, 2016

Qt5 build fixed.

@DestyNova DestyNova commented on the diff Jul 3, 2016
include/LocklessList.h
+ } ;
+
+ void push( T value )
+ {
+ Element * e = new Element;
+ e->value = value;
+
+ do
+ {
+#if QT_VERSION >= 0x050000
+ e->next = m_first.loadAcquire();
+#else
+ e->next = m_first;
+#endif
+ }
+ while( !m_first.testAndSetOrdered( e->next, e ) );
@DestyNova
DestyNova Jul 3, 2016

This looks like a busy-wait... is it likely to cause a performance problem, or can you use some kind of blocking thing here?

@DestyNova
DestyNova Jul 5, 2016 edited

Ah, upon reading a little bit about lockless lists, it seems that the while condition is much more likely to succeed than fail (because, of course, no lock is being held). So this should be fine. 👍

@mamins1376
Contributor

Hanging bug fixed with your patch but cpu usage is still high. the interesting part is that with or without your fix, a QThread makes system load average go up to 9!!!
I will try debugging with gdb(or valgrind) and do some experiments to find the problem.

@mamins1376
Contributor
mamins1376 commented Jul 3, 2016 edited

performance problem introduced in e55ec80.

@jasp00
Member
jasp00 commented Jul 6, 2016

The high CPU usage is fixed in #2893.

@jasp00 jasp00 merged commit c2a406e into LMMS:master Jul 6, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jasp00 jasp00 deleted the jasp00:worker-lock branch Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment