@@ -0,0 +1,18 | |||||
|
1 | def str_to_int(arg, queue): | |||
|
2 | result = int(arg) | |||
|
3 | queue.put({arg: result}) | |||
|
4 | ||||
|
5 | def combine(): | |||
|
6 | arguments = ('111', '222', '333') | |||
|
7 | q = Queue.Queue() | |||
|
8 | threads = [] | |||
|
9 | ||||
|
10 | for argument in arguments: | |||
|
11 | t = Thread(target=str_to_int, args=(argument, q)) | |||
|
12 | t.start() | |||
|
13 | threads.append(t) | |||
|
14 | ||||
|
15 | for t in threads: | |||
|
16 | t.join() | |||
|
17 | ||||
|
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