We have an internal discussion about the recommended usage of the 4 methods mentioned in subjects, when the goal is to protect an assignment of a variable (u32 - any platform) within one task so it is not resulting in an invalid reading from a higher priority task.
Mutex'es are usually good since they only disturb the threads being involved in accessing the shared variable - but are they overkill in this case?
irq_lock() sounds like something fast but effects the entire system
k_sched_lock() is fast (according to the manual) but effects all threads as I see it.
atomic is probably a good option, but what's the efficiency on e.g. an ARM platform not natively supporting atomic's.
Any ideas or recommendation about when to use what solution?