public void ClaimBuildState() { //! Spin until the lock can be claimed. while(Interlocked.CompareExchange(ref isProfilingBuildTime, 1, 0)==1); }