MCPcopy Create free account
hub / github.com/MorvanZhou/tutorials / multithreading

Function multithreading

threadingTUT/thread4_queue.py:15–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13 q.put(l)
14
15def multithreading():
16 q = Queue()
17 threads = []
18 data = [[1,2,3],[3,4,5],[4,4,4],[5,5,5]]
19 for i in range(4):
20 t = threading.Thread(target=job, args=(data[i], q))
21 t.start()
22 threads.append(t)
23 for thread in threads:
24 thread.join()
25 results = []
26 for _ in range(4):
27 results.append(q.get())
28 print(results)
29
30if __name__ == '__main__':
31 multithreading()

Callers 1

thread4_queue.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected