python threading blocks

后端 未结 1 725
名媛妹妹
名媛妹妹 2020-12-02 00:00

I am trying to write a program which creates new threads in a loop, and doesn\'t wait for them to finish. As i understand it if i use .start() on the thread, my main loop sh

相关标签:
1条回答
  • 2020-12-02 00:24

    This calls the function and passes its result as target:

    threading.Thread(target=DoWorkItem(), args=())
    

    Lose the parentheses to pass the function object itself:

    threading.Thread(target=DoWorkItem, args=())
    
    0 讨论(0)
提交回复
热议问题