[riot-notifications] [RIOT-OS/RIOT] [PoC] core: remove "volatile" from active_thread, active_pid. (#11073)
Juan I Carrano
notifications at github.com
Wed Feb 27 16:00:22 CET 2019
### Contribution description
__NOTE:__ _The main purpose of this PR is to test the change in the CI._
There is no reason for these two variables to be volatile:
* In application (thread) context, the "active_thread" never changes- if thread X is reading sched_active_pid, the value is always X whenever thread X is active.
* In kernel context, it is the kernel that changes the value, so again, it needs not be volatile.
With regards to the contents of the thread structure itself, sometimes it is important that it is re-read (for example in msg_* functions). Here, however, there are calls to extern-defined functions to yield, etc. Since the compiler cannot know if these functions alter global memory, it is forced to emit code re-read these variables, so again volatile is unncesessary (maybe if using LTO it can "smart up" and do something stupid.) If later it turns out that an explicit barrier is necessary, it can be added.
For more information on this discussion, see this thread:
And for more info on barriers vs volatile, see:
### Testing procedure
Run __ALL__ the tests.
### Related Issues
#252, #10177, also see the thread in the devel mailing list.
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* core: remove "volatile" from active_thread, active_pid.
-- File Changes --
M core/include/sched.h (4)
M core/include/thread.h (2)
M core/sched.c (6)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications