3 ms·
Thank you loeg, I appreciate you and information you brought that TIL. I've been using a compiler fence to force reloads from memory to prevent -O3 from optimi
by samsquire 3y ago
Thank you loeg, I appreciate you and information you brought that TIL.
I've been using a compiler fence to force reloads from memory to prevent -O3 from optimising away my variables/structs changing by other threads and keeping data in registers rather than reloading from memory each time. I saw the volatile recommended against from the Linux kernel programmers.
such as my thread->running == 1 in my event loops for my threads.
https://www.kernel.org/doc/html/latest/process/volatile-considered-harmful.html https://www.kernel.org/doc/html/latest/process/volatile-cons...
- loeg 3y ago> I've been using a compiler fence to force reloads from memory to prevent -O3 from optimising away my variables/structs changing by other threads I would highly recommend using the language standard atomic primitives instead.