multithreading - Python - How do I notify that a thread has finished to another class? -
I am using a thread to compute timed (and refreshing content in a PyGTK window) it is a loop Inside which can change its limit. At the end of each repetition the counter increases and the data is printed. What I want to do, is to get Bang and its data in the second category at the end of each tick.
Perhaps the solution is related to the socket, but so far I'm trying to avoid it, so what would be the best way to achieve it?
The most common solution to pass the object between the thread is to use the module: < Pre> To better respond, you have to post more features. import threading import queue import time DEIF worker (Q, N): for category (N): time.sleep (i / 10.0) queue.put ([i] * i) q = queue.Queue () Thread = Threading Thread (target = worker, args = (q, 10)) thread. Start () result = 10 while results & gt; 0: print q.get () result - = 1
Comments
Post a Comment