Python ์์๋ 2๊ฐ์ง thread interface ๋ฅผ ์ ๊ณตํ๋ค. ํ๋๋ C ์คํ์ผ์ API ๋ฅผ, ํ๋๋ Java ์คํ์ผ์ Thread Object๋ฅผ.
์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋งค์ฐ ๊ฐ๋จ. Thread class ๋ฅผ ์์๋ฐ์๋ค Java ์ฒ๋ผ start ๋ฉ์๋๋ฅผ ํธ์ถํด์ฃผ๋ฉด run ๋ฉ์๋์ ๊ตฌํ๋ ๋ด์ฉ์ด multithread ๋ก ์คํ๋๋ค.
๋ค์์ ๊ฐ๋จํ ์.
~cpp import thread import time def runOne(args): i = 0 while(1): i = i+1 print "thread : ", i, args time.sleep(1) if __name__=="__main__": thread.start_new_thread(runOne, ((1,))) for i in range(100000,0,-1): print "waiting: ", i time.sleep(1)