파이썬 멀티스레딩 질문
조회수 105회
파이썬에서 멀티스레딩을 구현하려고하는데
t_0의 스레드가 함수에 진입했을때 while 1 에서 계속해서 잡혀있는 상태에서 그 다음 t_1 스레드를 실행시키는 코드로 넘어가지 않습니다.
실행 시킬 때 첫번재 스레드가 종료되지 않으면 다음 스레드는 실행되지 않는 것인가요?
def a():
_compare()
def b():
_refresh()
if __name__ == '__main__':
t_0 = threading.Thread(target=a(), name='t0', deamon=True)
t_1 = threading.Thread(target=b(), name='t1' , deamon=True)
def _compare():
fCount = _totalCount() #비교대상
try:
while 1:
cCount = _totalCount()
if fCount == cCount:
time.sleep(10) #비교해서 같으면 10초 대기
elif fCount < cCount:
_printChange(cCount)
fCount = cCount
time.sleep(10)
else:
_compare()
time.sleep(10)
except:
Alarm._exceptAlarm()
댓글 입력