News for hackers. Stuff that matters.
Re:Four common mistakes in audio development (2016) by Gibbon1 on Sunday September 22, 2019 @07:00PM (#21044536)
The problem with locks on a non real time os is that the OS may decide to interrupt your thread while it's holding the lock. No matter how short that is. I do embedded I've had similar things happen when the 'lock' is held for just a few instructions.

Tip: If you suspect crap like this, adding spin delays will make it happen often enough to debug.

Re:Four common mistakes in audio development (2016) by proverbialbunny on Sunday September 22, 2019 @11:18PM (#21045674)
By any chance do you have any references or information on how to do this (adding a spin delay)? It sounds interesting. -thanks :)
Re:Four common mistakes in audio development (2016) by Gibbon1 on Sunday September 22, 2019 @11:37PM (#21045742)
In C it's very simple

   volatile int cnt = 0x1000;
   while(cnt--)
     ;
Re:Four common mistakes in audio development (2016) by hoseja on Monday September 23, 2019 @04:06AM (#21046861)
I've grown so paranoid of optimizing compilers this wouldn't even cross my mind. But it is correct, right?
Re:Four common mistakes in audio development (2016) by AlbertoGP on Monday September 23, 2019 @04:55AM (#21047109)
Not OP, but the “volatile” qualifier should prevent the compiler from optimizing it out.
Re:Four common mistakes in audio development (2016) by Gibbon1 on Monday September 23, 2019 @05:31PM (#21053945)
Yeah should.

Multicore super scalar processors make me nervous about my assumptions. I wouldn't put it past one of them to realize that the result is unused and nop it.

It's always good to check.

Re:Four common mistakes in audio development (2016) by vemv on Monday September 23, 2019 @02:21AM (#21046396)
I see now, thanks!