Python Multithreading how to set 1 pool to run tasks as a queue -


i want make 1 pool run tasks should follow queue , order.

import multiprocessing import time  def func(msg):    in xrange(3):       print msg    time.sleep(2)  if __name__ == "__main__":     pool = multiprocessing.pool(processes=1)     in xrange(10):        msg = "hello %d" %(i)        pool.apply_async(func, (msg, ))     pool.close()      time.sleep(50);     print "sub-process(es) done."    

it can print something. there not come 1 one. done immediately

actually runs @ different time. show @ same time.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -