Add files via upload
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from multiprocessing import Pool
|
||||
|
||||
import time
|
||||
|
||||
work = (["A", 5], ["B", 2], ["C", 1], ["D", 3])
|
||||
|
||||
|
||||
def work_log(work_data):
|
||||
print(" Process %s waiting %s seconds" % (work_data[0], work_data[1]))
|
||||
time.sleep(int(work_data[1]))
|
||||
print(" Process %s Finished." % work_data[0])
|
||||
|
||||
|
||||
def pool_handler():
|
||||
p = Pool(2)
|
||||
p.map(work_log, work)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pool_handler()
|
||||
Reference in New Issue
Block a user