Fx.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. Copyright (c) 2013, 2014 Paolo Patierno
  3. All rights reserved. This program and the accompanying materials
  4. are made available under the terms of the Eclipse Public License v1.0
  5. and Eclipse Distribution License v1.0 which accompany this distribution.
  6. The Eclipse Public License is available at
  7. http://www.eclipse.org/legal/epl-v10.html
  8. and the Eclipse Distribution License is available at
  9. http://www.eclipse.org/org/documents/edl-v10.php.
  10. Contributors:
  11. Paolo Patierno - initial API and implementation and/or initial documentation
  12. */
  13. using System.Threading;
  14. using System.Threading.Tasks;
  15. namespace uPLibrary.Networking.M2Mqtt
  16. {
  17. /// <summary>
  18. /// Support methods fos specific framework
  19. /// </summary>
  20. public class Fx
  21. {
  22. public delegate void ThreadStart();
  23. public static void StartThread(ThreadStart threadStart)
  24. {
  25. Task.Factory.StartNew(o => ((ThreadStart)o)(), threadStart);
  26. }
  27. public static void SleepThread(int millisecondsTimeout) { Task.Delay(millisecondsTimeout).RunSynchronously(); }
  28. }
  29. }