Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
exchange.Go
EventLoop
ctx.subscribe
ctx.poll
ctx.book
threading
threading.Thread
threading.getThread
threading.mainThread
threading.currentThread
threading.Lock
threading.Condition
threading.Event
threading.Dict
threading.Serve
threading.pending
Thread
ThreadLock
ThreadEvent
ThreadCondition
ThreadDict
Server
TA
Talib
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Gets a thread object based on the specified thread ID.

getThread(threadId)

Examples

Get the specified thread object by threadId.

javascript
function main() { var t1 = threading.Thread(function () { // Thread object has method: id(), used to get the thread's Id, you can check the documentation for the corresponding Thread object section var id = threading.currentThread().id() var thread1 = threading.getThread(id) Log("id:", id, ", thread1.id():", thread1.id()) Log(`id == thread1.id():`, id == thread1.id()) }) t1.join() }

Returns

TypeDescription

Thread object

Thread object specified by the parameter threadId

Arguments

NameTypeRequiredDescription

threadId

number

Yes

The parameter threadId is the thread object ID, which is used to get the corresponding thread object.

See Also

Remarks

Supports backtesting system and live trading environment.

If the target thread has finished executing and been released, the thread object cannot be obtained through threading.getThread(threadId).