mosa/MOSA-Project — pull request #34 by charsleysa (2014-04-13 02:56:41+00:00)
Title: Implemented rudimentary Spinlock

Implemented rudimentary SpinLock that does not follow .NET spec.

SpinLock is a struct with two internal call methods, one private boolean, Enter(), Exit() and public IsHeld to expose the status of the private boolean.

Every instance of the SpinLock struct has its own boolean so locking one instance does not lock another instance.

Care should be taken because calling Enter() on an already locked instance will cause an infinite loop until another thread unlocks the instance.

If the an instance is locked on the OS thread and Enter() is called again then it will hang the entire OS, there are no protections in this implementation.