tomato13 2011. 1. 10. 11:20

http://www.wellho.net/solutions/python-python-threads-a-first-example.html


import os

import re

import time

import sys

from threading import Thread


class testit(Thread):

   def __init__ (self,a_cnt):

      Thread.__init__(self)

      self.l_cnt = a_cnt

   def run(self):

      while 1:

        print self.l_cnt

        time.sleep(1)


print time.ctime()


pinglist = []


for l_cnt in range(0,10):

  current = testit(l_cnt)

  pinglist.append(current)

  current.start()


for pingle in pinglist:

   pingle.join()


print time.ctime()