TaskServicesImpl.cs 836 B

12345678910111213141516171819202122
  1. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4. #if HAS_TPL46
  5. namespace System.Reactive.PlatformServices
  6. {
  7. //
  8. // WARNING: This code is kept *identically* in two places. One copy is kept in System.Reactive.Core for non-PLIB platforms.
  9. // Another copy is kept in System.Reactive.PlatformServices to enlighten the default lowest common denominator
  10. // behavior of Rx for PLIB when used on a more capable platform.
  11. //
  12. internal class /*Default*/TaskServicesImpl : ITaskServices
  13. {
  14. public bool TrySetCanceled<T>(TaskCompletionSource<T> tcs, CancellationToken token)
  15. {
  16. return tcs.TrySetCanceled(token);
  17. }
  18. }
  19. }
  20. #endif