Thread.Stub.cs 841 B

123456789101112131415161718192021222324252627282930313233343536
  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_THREAD
  5. using System;
  6. using System.Threading;
  7. namespace System.Reactive.Concurrency
  8. {
  9. class Thread
  10. {
  11. private readonly ThreadStart _start;
  12. public Thread(ThreadStart start)
  13. {
  14. _start = start;
  15. }
  16. public string Name { get; set; }
  17. public bool IsBackground { get; set; }
  18. public void Start()
  19. {
  20. System.Threading.Tasks.Task.Factory.StartNew(Run, System.Threading.Tasks.TaskCreationOptions.LongRunning);
  21. }
  22. private void Run()
  23. {
  24. _start();
  25. }
  26. }
  27. delegate void ThreadStart();
  28. }
  29. #endif