Skip to content

Instantly share code, notes, and snippets.

@scola
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scola/02afac981a7341a8df6e to your computer and use it in GitHub Desktop.
Save scola/02afac981a7341a8df6e to your computer and use it in GitHub Desktop.
import thread
import time
def hello(name=''):
while 1:
time.sleep(2)
print "hello ", name
def main():
thread.start_new_thread(hello, ('bob',))
time.sleep(1)
thread.start_new_thread(hello, ('alice',))
while 1:
name = raw_input('Please input your name:')
if name.strip(): thread.start_new_thread(hello, (name,))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment