螺纹

Inherits: Reference < Object

类别: 核心

简要说明

进程中的执行单元。

方法

String

get_id ( ) const

bool

is_active ( ) const

Error

start ( Object instance, String method, Variant userdata=null, Priority priority=1 )

Variant

wait_to_finish ( )

枚举

枚举 优先

  • PRIORITY_LOW = 0

  • PRIORITY_NORMAL = 1

  • PRIORITY_HIGH = 2

描述

进程中的执行单元。无法在上运行方法 Object 同时。使用同步通过 MutexSemaphore 建议使用共享对象。

方法说明

返回当前 Thread 的ID,在所有线程中唯一标识它。

  • bool is_active ( ) const

返回 true 如果这样 Thread 当前处于活动状态。一个活跃的 Thread 无法开始新方法的工作,但可以与 wait_to_finish .

开始新的 Thread 那是跑步 method 在对象上 instance 具有 userdata 作为参数传递。这个 priorityThread 可以通过传递 Priority 枚举。

返回 @GlobalScope.OK 关于成功,或 @GlobalScope.ERR_CANT_CREATE 失败论。

加入 Thread 等待它完成。返回方法调用返回的内容。