[code.view]

[top] / python / PyMOTW / threading / threading_simple.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """Creating and waiting for a thread.
     """
     #end_pymotw_header
     
     import threading
     
     def worker():
         """thread worker function"""
         print 'Worker'
         return
     
     threads = []
     for i in range(5):
         t = threading.Thread(target=worker)
         threads.append(t)
         t.start()
     

[top] / python / PyMOTW / threading / threading_simple.py

contact | logmethods.com