暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ScheduledInvocationComparer.cs 889B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections.Generic;
  2. namespace Unity.Services.Core.Scheduler.Internal
  3. {
  4. class ScheduledInvocationComparer : IComparer<ScheduledInvocation>
  5. {
  6. public int Compare(ScheduledInvocation x, ScheduledInvocation y)
  7. {
  8. if (ReferenceEquals(x, y))
  9. {
  10. return 0;
  11. }
  12. if (ReferenceEquals(null, y))
  13. {
  14. return 1;
  15. }
  16. if (ReferenceEquals(null, x))
  17. {
  18. return -1;
  19. }
  20. var compareResult = x.InvocationTime.CompareTo(y.InvocationTime);
  21. // Actions with same invocation time will execute in id order (schedule order).
  22. if (compareResult == 0)
  23. {
  24. compareResult = x.ActionId.CompareTo(y.ActionId);
  25. }
  26. return compareResult;
  27. }
  28. }
  29. }