Apr 24, 2020 03:38 PM|bruce (sqlwork.com)|LINK
yes. it two threads call interlocked at the same time, they both will get different values. its the simplest and fastest solution to your requirement.
note: the interlocked library is designed around hardware instructions, so no actual software locking (like a spin lock) is required.