ApplicationInstanceManager.cs 847 B

12345678910111213141516171819202122232425262728293031
  1. using Ryujinx.Horizon.Sdk.OsTypes;
  2. using System;
  3. using System.Threading;
  4. namespace Ryujinx.Horizon.Sdk.Arp.Detail
  5. {
  6. class ApplicationInstanceManager : IDisposable
  7. {
  8. private int _disposalState;
  9. public SystemEventType SystemEvent;
  10. public int EventHandle;
  11. public readonly ApplicationInstance[] Entries = new ApplicationInstance[2];
  12. public ApplicationInstanceManager()
  13. {
  14. Os.CreateSystemEvent(out SystemEvent, EventClearMode.ManualClear, true).AbortOnFailure();
  15. EventHandle = Os.GetReadableHandleOfSystemEvent(ref SystemEvent);
  16. }
  17. public void Dispose()
  18. {
  19. if (EventHandle != 0 && Interlocked.Exchange(ref _disposalState, 1) == 0)
  20. {
  21. Os.DestroySystemEvent(ref SystemEvent);
  22. }
  23. }
  24. }
  25. }