Python Library Task
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

delayed.py 377B

123456789101112131415161718192021
  1. #!/usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3. import sys
  4. sys.path.append('../..')
  5. import task
  6. import time
  7. def time_print(txt):
  8. sys.stdout.write(time.asctime() + ': ' + txt + '\n')
  9. print("task.delayed example:\n---------------------")
  10. dt = task.delayed(5, time_print, "A delayed hello!")
  11. dt.run()
  12. try:
  13. time_print("starting...")
  14. dt.join()
  15. finally:
  16. dt.stop()