##// END OF EJS Templates
testing threading
imanay -
r163:164
parent child
Show More
@@ -0,0 +1,18
1 def str_to_int(arg, queue):
No newline at end of file
2 result = int(arg)
No newline at end of file
3 queue.put({arg: result})
No newline at end of file
4
No newline at end of file
5 def combine():
No newline at end of file
6 arguments = ('111', '222', '333')
No newline at end of file
7 q = Queue.Queue()
No newline at end of file
8 threads = []
No newline at end of file
9
No newline at end of file
10 for argument in arguments:
No newline at end of file
11 t = Thread(target=str_to_int, args=(argument, q))
No newline at end of file
12 t.start()
No newline at end of file
13 threads.append(t)
No newline at end of file
14
No newline at end of file
15 for t in threads:
No newline at end of file
16 t.join()
No newline at end of file
17
No newline at end of file
18 return [q.get() for _ in xrange(len(arguments))] No newline at end of file
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now