File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -108,17 +108,17 @@ def f():
108108 object = "A" * 40_000_000
109109 time.sleep(0.5)
110110
111+ if __name__ == "__main__":
112+ proc_1 = Process(target=f)
113+ proc_2 = Process(target=f)
111114
112- proc_1 = Process(target=f )
113- proc_2 = Process(target=f )
115+ proc_1.start( )
116+ proc_2.start( )
114117
115- proc_1.start ()
116- proc_2.start ()
118+ proc_1.join ()
119+ proc_2.join ()
117120
118- proc_1.join()
119- proc_2.join()
120-
121- print(proc_1.exitcode, proc_2.exitcode)
121+ print(proc_1.exitcode, proc_2.exitcode)
122122 """
123123 )
124124
@@ -137,8 +137,9 @@ def test_multiprocessing_pool(self):
137137 def f(x):
138138 return x*x
139139
140- with Pool(2) as p:
141- print(p.map(f, [1, 2, 3]))
140+ if __name__ == "__main__":
141+ with Pool(2) as p:
142+ print(p.map(f, [1, 2, 3]))
142143 """
143144 )
144145
You can’t perform that action at this time.
0 commit comments