public void Wait(bool allowCallbacks, int count, uint timeoutUs) { if (CurrentCount >= count) { CurrentCount -= count; } else { KThread thread = Kernel.ActiveThread; thread.Wait(this, count, timeoutUs, allowCallbacks); } }
// timeoutUs may not be right public void Lock(uint timeoutUs) { if (Locked == false) { Locked = true; } else { KThread thread = Kernel.ActiveThread; thread.Wait(this, timeoutUs); } }