thread inside while True loop

kiri



i am executing the tick_func which processes the ticks inside while loop . but this creates infinite threads to repeat the same function .is there any better way of looping the tick_func with threading
q.PNG 48.4K
  • SRIJAN
    SRIJAN edited May 2022
    You can try method 2 as described here:
    https://kite.trade/forum/discussion/comment/25535/#Comment_25535

    Or,just shift your lines defining t1 and t1.start() under the
    if count==0,or any other if statement so that the thread is only started once.
  • kiri
    kiri edited May 2022
    that will just create a single thread and execute tick_func only once .... just discovered the threadpool executor which can be placed inside while True , it creates and shuts a thread for every iteration
Sign In or Register to comment.