Header solution is rather significant and I gave up on an attempt to clean it up. This has as two-fold side effect:
- a separate struct is defined which "knows" about relevant offsets
- the thing is opt in
struct thread got reorganized to keep frequently modified fields together.
Attempts to make the change mandatory cause compilation failures on a number of archs as 'current' is not exposed and I failed to find an easy way to fix that.
I don't feel strongly about the way this is done whatsoever, I just want inlined critical_* which are usable from sys/mutex.h.