TaskServicesImpl.cs 857 B

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