get_current_hthread_idget_current_hthread_idGetCurrentHthreadIdGetCurrentHthreadIdget_current_hthread_id (算子)

名称

get_current_hthread_idget_current_hthread_idGetCurrentHthreadIdGetCurrentHthreadIdget_current_hthread_id — 返回当前线程的 HALCON 线程 ID。

签名

get_current_hthread_id( : : : HThreadID)

Herror get_current_hthread_id(Hlong* HThreadID)

Herror T_get_current_hthread_id(Htuple* HThreadID)

void GetCurrentHthreadId(HTuple* HThreadID)

static Hlong HSystem::GetCurrentHthreadId()

static void HOperatorSet.GetCurrentHthreadId(out HTuple HThreadID)

static int HSystem.GetCurrentHthreadId()

def get_current_hthread_id() -> int

描述

get_current_hthread_idget_current_hthread_idGetCurrentHthreadIdGetCurrentHthreadIdGetCurrentHthreadIdget_current_hthread_id returns a thread ID that represents the currently running thread in HThreadIDHThreadIDHThreadIDHThreadIDHThreadIDhthread_id. This ID is identical to the windows thread ID or the POSIX thread ID on UNIX platforms and is also returned by the par_start operation of the HDevEngine. It can later be used to interrupt operators that are executed in this thread using interrupt_operatorinterrupt_operatorInterruptOperatorInterruptOperatorInterruptOperatorinterrupt_operator

执行信息

参数

HThreadIDHThreadIDHThreadIDHThreadIDHThreadIDhthread_id (输出控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

ID representing the current thread.

示例(HDevelop)

global tuple HThreadID
get_current_hthread_id (HThreadID)
* call some slow operator...

* In a different thread
wait_seconds(2)
* Interrupt the long-running operator in the other thread
interrupt_operator (HThreadID, 'break')

结果

If the current thread can be determined, get_current_hthread_idget_current_hthread_idGetCurrentHthreadIdGetCurrentHthreadIdGetCurrentHthreadIdget_current_hthread_id 返回 2 ( H_MSG_TRUE )。否则将抛出异常。

可能的后继

interrupt_operatorinterrupt_operatorInterruptOperatorInterruptOperatorInterruptOperatorinterrupt_operator

另见

interrupt_operatorinterrupt_operatorInterruptOperatorInterruptOperatorInterruptOperatorinterrupt_operator, set_operator_timeoutset_operator_timeoutSetOperatorTimeoutSetOperatorTimeoutSetOperatorTimeoutset_operator_timeout

模块

基础