#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys
sys.path.append('../..')
import task
import time


def time_print(txt):
    sys.stdout.write(time.asctime() + ': ' + txt + '\n')


print("task.delayed example:\n---------------------")
dt = task.delayed(5, time_print, "A delayed hello!")
dt.run()
try:
    time_print("starting...")
    dt.join()
finally:
    dt.stop()
