TaskServicesImpl.cs 935 B

12345678910111213141516171819202122232425262728
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. #if !NO_TPL
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. #if HAS_TPL46
  8. namespace System.Reactive.PlatformServices
  9. {
  10. //
  11. // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
  12. // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
  13. // behavior of Rx for PLIB when used on a more capable platform.
  14. //
  15. internal class /*Default*/TaskServicesImpl : ITaskServices
  16. {
  17. public bool TrySetCanceled<T>(TaskCompletionSource<T> tcs, CancellationToken token)
  18. {
  19. return tcs.TrySetCanceled(token);
  20. }
  21. }
  22. }
  23. #endif
  24. #endif