The reading and writing of integers is not a system call, so it is not explicitly protected in any way.
It will mostly work, but there are circumstances in which it is unsafe. For example, the integer type might be larger than the size of the write, or it might not be on a word boundary, and so on. You would also have to watch out for caching and reordering and so on affecting the logic of your code.
You would want to have a good reason for doing this sort of trick.
|