Kees,

On 7/1/19 21:19, Kees Bakker wrote:

My main concern is: who made it volatile in the first place? And what was the
reasoning behind it?

Today I had some discussion with Gaƫtan. We realize that it should not be volatile at all:

* In application (thread) context, the value never changes- if thread X is reading sched_active_thread, 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.


Your two alternatives result in basically the same situation as the casted pointer.
The problem will always be that we need someone to judge whether the cast
is correct (in the case of the union, do I need the volatile or the non volatile
version).

In kernel code, non volatile, everywhere else, volatile. But, as I realize now, volatile is not even necessary and what I wrote in the previous email does not longer apply.

In conclusion, I believe now that the volatile qualifier should go away.

Regards,

Juan.
_______________________________________________
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to