Created
April 17, 2018 18:40
-
-
Save kylewu/d6a7900a7cd0818749c291e921d506b7 to your computer and use it in GitHub Desktop.
multiprocessing pool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Pool | |
class Test(object): | |
def __init__(self): | |
self.array = [] | |
def task(self, n): | |
self.array.append(n) | |
print(self.array) | |
def run(self): | |
p = Pool(4) | |
p.map(self.task, [1, 2, 3, 4]) | |
Test().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment