Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import thread
- import time
- # Define a function for the thread
- def print_time( threadName, delay):
- count = 0
- while count < 9999:
- time.sleep(delay)
- count += 1
- print "%s: %s" % ( threadName, time.ctime(time.time()) )
- # Create two threads as follows
- try:
- thread.start_new_thread( print_time, ("Thread-1", 5, ) )
- thread.start_new_thread( print_time, ("Thread-2", 5, ) )
- except:
- print "Error: unable to start thread"
- while 1:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement