multiprocessing threadpool

Solutions on MaxInterview for multiprocessing threadpool by the best coders in the world

showing results for - "multiprocessing threadpool"
Ariadna
14 Mar 2020
1
2from multiprocessing.pool import ThreadPool
3
4def stringFunction(value):
5    my_str = 3 + value
6    return my_str
7
8
9def stringFunctio(value):
10    my_str = 33 + value
11    return my_str
12
13
14
15pool = ThreadPool(processes=1)
16
17    
18thread1 = pool.apply_async(stringFunction,(8,))
19thread2 = pool.apply_async(stringFunctio,(8,))
20
21return_val = thread1.get()
22return_val1 = thread2.get()