How to: Use SpinLock for Low-Level Synchronization
跑了一下下面的例子,发现在100000级别,SpinLock比对象lock要快不少,但是随着N的增大,效率差异基本没有,有时甚至更加慢。Inthisexample,thecriticalsectionperformsaminimalamountofwork,whichmakesitagoodcandidateforaSpinLock.Increasingtheworkasmallamountinc