Sumber dimuat naik... memuat...

mainThread

PeraturanmainThread()fungsi digunakan untuk mendapatkan objek benang benang utama, iaitu benang di manamain()fungsi dalam strategi terletak.

PeraturanmainThread()fungsi mengembalikan objek benang benang utama.

Threadobjek

mainThread()

function main() {
    Log("The threadId of the main thread:", threading.mainThread().id())
}

DapatkanThreadobjek benang utama dan outputthreadIddaripada benang utama.

function test() {
    Log("Output the main thread ID in the test function:", threading.mainThread().id())
}

function main() {
    var t1 = threading.Thread(test)
    t1.join()
}

Objek benang benang utama juga boleh diperoleh dalam benang serentak.

Ia menyokong sistem backtesting dan persekitaran perdagangan langsung.

{@fun/Threads/getThread getThread}, {@fun/Threads/threading/Thread Thread}, {@fun/Threads/threading/currentThread currentThread}, {@fun/Threads/threading/Lock Lock}, {@fun/Threads/threading/Condition Condition}, {@fun/Threads/threading/Event Event}, {@fun/Threads/threads/Dict Dict}, {@fun/Threads/threading/pending pending}, {@fun/Threads/threading/eventLoop Loop}

getThread Thread semasa