3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.2 3.2.1 3.2.0 Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish
3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.2 3.2.1 3.2.0 Korean English Chinese Czech Dutch French German Hungarian Italian Japanese Polish Portuguese Spanish

thread_stop()

Definition

thread_stop(th_id)

Features

This function terminates a thread.

The program is automatically terminated when the DRL program is terminated even if the thread_stop() command is not used.

Parameters

Parameter Name

Data Type

Default Value

Description

th_id

int

-

Thread ID to stop

Return

Value

Description

0

Success

Negative value

Failed

Exception

Exception

Description

DR_Error (DR_ERROR_TYPE)

Parameter data type error occurred

DR_Error (DR_ERROR_VALUE)

Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME)

C extension module error occurred

DR_Error (DR_ERROR_STOP)

Program terminated forcefully

Example

Python
def fn_th_func():
	if check_motion()==0:	# No motion in action
		set_digital_output(1, OFF)
	else:
		set_digital_output(1, ON)
#----- Main routine -------------------------------------- 	
th_id = thread_run(fn_th_func, loop=True)

# do something…
thread_stop(th_id) # Stops the thread.

Keyword

thread / thread_