Skip to content

Instantly share code, notes, and snippets.

@teepark
Created September 4, 2012 04:53
Show Gist options
  • Save teepark/3616725 to your computer and use it in GitHub Desktop.
Save teepark/3616725 to your computer and use it in GitHub Desktop.
multiprocessing's threadpool on greenhouse emulation
from greenhouse import emulation
mp_pool = emulation.patched("multiprocessing.pool")
def cb(x):
print 'callback:', x
tp = mp_pool.ThreadPool()
tp.apply_async(lambda a, b: a * b, (4, 5), {}, cb)
greenhouse.pause_for(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment