Support Spin-Locks


Support the ability to use spin locks before using Monitor.Wait. Spin locks will only need to be done a short amount of time to avoid the overhead that Monitor.wait() might incur. This will help with the overhead that Monitor.Wait has in the case where locking has a small window-span. This improvement will be noticed most on multi-core and multi-processor systems.
Closed Oct 7, 2010 at 8:27 AM by TamusJRoyce
Spinlocks are now being used in place of all the places where lock/SyncLock was being used. There is also a small SpinLock which runs (currently 90 times), checking if the locking situation has resolved before it is required to put the thread to sleep.


TamusJRoyce wrote Dec 7, 2010 at 4:09 AM

SyncLock/PulseAll is gone. It is much faster to use Thread.Wait(1), which forces a thread context to switch. Also, Thread.Wait(1) does not mean to wait for 1 ms as I had previously thought, but instead it means it must wait at least 1 ms, which is enough time to force switching threads.

wrote Feb 12, 2013 at 10:43 PM

wrote May 15, 2013 at 1:12 AM