Updated mp tests
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import multiprocessing
|
||||
import time
|
||||
|
||||
data = (['a', '2'], ['b', '4'], ['c', '6'], ['d', '8'],
|
||||
['e', '1'], ['f', '3'], ['g', '5'], ['h', '7']
|
||||
)
|
||||
|
||||
|
||||
def mp_handler(var1):
|
||||
for indata in var1:
|
||||
p = multiprocessing.Process(target=mp_worker, args=(indata[0], indata[1]))
|
||||
p.start()
|
||||
|
||||
|
||||
def mp_worker(inputs, the_time):
|
||||
print " Processs %s\tWaiting %s seconds" % (inputs, the_time)
|
||||
time.sleep(int(the_time))
|
||||
print " Process %s\tDONE" % inputs
|
||||
|
||||
if __name__ == '__main__':
|
||||
mp_handler(data)
|
||||
Reference in New Issue
Block a user