Breadcrumbs

thread_stop()

정의

thread_stop(th_id)

기능

Thread를 종료합니다.

DRL 프로그램이 종료될 경우에 thread_stop() 명령을 사용하지 않아도 자동으로 종료됩니다.

인수

인수명

자료형

기본값

설명

th_id

int

-

Stop 하고자 하는 thread ID

리턴

설명

0

성공

음수값

실패

예외

예외

설명

DR_Error (DR_ERROR_TYPE)

인수들의 데이터형 오류 시

DR_Error (DR_ERROR_VALUE)

인수의 값이 유효하지 않을 시

DR_Error (DR_ERROR_RUNTIME)

C Extension 모듈 에러 발생 시

DR_Error (DR_ERROR_STOP)

프로그램 강제 종료 시

예제

Python
def fn_th_func():
  if check_motion()==0: # 수행 중인 모션이 없는 경우
    set_digital_output(1, OFF)
  else:
    set_digital_output(1, ON)
#----- 메인 루틴 -------------------------------------- 
th_id = thread_run(fn_th_func, loop=True)

# do something…
thread_stop(th_id) #쓰레드 종료