Created
February 27, 2014 14:50
-
-
Save zeldani/9251513 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python: | |
import thread | |
import time | |
def print_time (nomedothread, delay): | |
conta = 0 | |
while conta < 5: | |
time.sleep(delay) | |
conta += 1 | |
print "%s: %s" % (nomedothread, time.ctime(time.time()) ) | |
# Criando o thread: | |
try: | |
thread.start_new_thread( print_time, ("Thread-1", 2, ) ) | |
thread.start_new_thread( print_time, ("Thread-2", 4, ) ) | |
except: | |
print "Erro: nao foi possivel iniciar o thread." | |
while 1: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment