i can not see the error, maybe someone can help me out here.
I have a custom lock using spinlock (it's a for school)
public class Spinlock : Locker
{
Boolean locked = false;
private SpinLock spinLock = new SpinLock();
public override void LockIt()
{
try
{
spinLock.Enter(ref locked);
}
finally
{
if(locked)
spinLock.Exit();
}
}
public override void UnlockIt()
{
}
}
public abstract class Locker
{
abstract public void LockIt();
abstract public void UnlockIt();
}
The exception i get is the following:
System.ArgumentException was unhandled
Message=The tookLock argument must be set to false before calling this method.