Skip to content

Instantly share code, notes, and snippets.

@zeldani
Created February 27, 2014 14:52
Show Gist options
  • Save zeldani/9251566 to your computer and use it in GitHub Desktop.
Save zeldani/9251566 to your computer and use it in GitHub Desktop.
import logging
import threading
import time
logging.basicConfig(level=logging.DEBUG,
format='[%(levelname)s] (%(threadName)-10s) %(message)s',
)
def imagem():
logging.debug('Iniciando')
time.sleep(2)
logging.debug('Finalizando')
def som():
logging.debug('Iniciando')
time.sleep(3)
logging.debug('Finalizando')
t1 = threading.Thread(name='Thread-1-Som', target=som)
t2 = threading.Thread(name='Thread-2-Imagem', target=imagem)
t3 = threading.Thread(name='Thread-3-Imagem', target=imagem)
t1.start()
t2.start()
t3.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment