##// END OF EJS Templates
testing threading
testing threading

File last commit:

r162:163
r162:163
Show More
test9.py
17 lines | 399 B | text/x-python | PythonLexer
def str_to_int(arg, queue):
result = int(arg)
queue.put({arg: result})
def combine():
arguments = ('111', '222', '333')
q = Queue.Queue()
threads = []
for argument in arguments:
t = Thread(target=str_to_int, args=(argument, q))
t.start()
threads.append(t)
for t in threads:
t.join()
return [q.get() for _ in xrange(len(arguments))]