B
B
bondle2021-10-30 11:45:35
Python
bondle, 2021-10-30 11:45:35

How to implement events between threads?

def messageHandler():
    print('message')

messageHandler1 = threading.Thread(target=messageHandler)
messageHandler2 = threading.Thread(target=messageHandler)

while True:
    message = 'lmfvl'
    # here need to send event
    time.sleep(1)


In place # here need to send event I need to call an event which will be sent to one of the messageHandler threads. The message must be passed in the event.
Dripped towards threading.Event but without success

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-10-30
@bondle

https://docs.python.org/3/library/queue.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question