KThreadContext.cs 351 B

12345678910111213141516171819
  1. using System.Threading;
  2. namespace Ryujinx.HLE.HOS.Kernel.Threading
  3. {
  4. class KThreadContext
  5. {
  6. private int _locked;
  7. public bool Lock()
  8. {
  9. return Interlocked.Exchange(ref _locked, 1) == 0;
  10. }
  11. public void Unlock()
  12. {
  13. Interlocked.Exchange(ref _locked, 0);
  14. }
  15. }
  16. }