_thread_example.py 391 B

123456789101112131415161718192021
  1. #
  2. # Copyright (c) 2006-2019, RT-Thread Development Team
  3. #
  4. # SPDX-License-Identifier: MIT License
  5. #
  6. # Change Logs:
  7. # Date Author Notes
  8. # 2019-06-13 SummerGift first version
  9. #
  10. import _thread
  11. import utime as time
  12. def testThread():
  13. while True:
  14. print("Hello from thread")
  15. time.sleep(2)
  16. _thread.start_new_thread(testThread, ())
  17. while True:
  18. pass