4 ms·
You are right, but I have not mentioned this detail because it is common for all kinds of locks and I wanted to point out which are the important differences be
by adrian_b 3y ago
You are right, but I have not mentioned this detail because it is common for all kinds of locks and I wanted to point out which are the important differences between them, not to give an exhaustive description of a spin lock algorithm.
Releasing a lock must be done with a release barrier followed by an atomic store.
On ISAs that do not have release barriers, a full memory barrier is required instead.
All x86 stores include an implicit release barrier and the 64-bit Armv8 and Armv9 CPUs have store-release instructions that include an implicit release barrier, so on such CPUs an explicit release barrier is not needed.