peterson algorithm in c# with memory barrier