@@ -0,0 +1,2135 @@
+from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor%0Aimport multiprocessing%0Afrom multiprocessing.pool import ThreadPool%0Aimport threading%0Aimport time%0A%0A%0Adef bar(i=0):%0A    if i == 0:%0A        raise ValueError(%22bar raise%22)%0A    return i ** 2%0A%0A%0Adef main_Thread():%0A    thread = threading.Thread(target=bar)%0A    thread.start()%0A    thread.join()%0A    raise RuntimeError(%22Exception not caught%22)%0A%0A%0Adef main_ThreadPool():%0A    p = ThreadPool(4)%0A    for i in p.map(bar, xrange(4)):%0A        print i%0A    raise RuntimeError(%22Exception not caught%22)%0A%0A%0Adef main_ThreadPoolExecutorMap():%0A    with ThreadPoolExecutor(4) as ex:%0A        for i in ex.map(bar, xrange(4)):%0A            print i%0A    raise RuntimeError(%22Exception not caught%22)%0A%0A%0Adef main_ThreadPoolExecutorSubmit():%0A    with ThreadPoolExecutor(4) as ex:%0A        s = ex.submit(bar)%0A        print s.result()%0A    raise RuntimeError(%22Exception not caught%22)%0A%0A%0Adef main_Process():%0A    thread = multiprocessing.Process(target=bar)%0A    thread.start()%0A    thread.join()%0A    raise RuntimeError(%22Exception not caught%22)%0A%0A%0Adef main_ProcessPool():%0A    p = multiprocessing.Pool(4)%0A    for i in p.map(bar, xrange(4)):%0A        print i%0A    raise RuntimeError(%22Exception not caught%22)%0A%0A%0Adef main_ProcessPoolExecutorMap():%0A    with ProcessPoolExecutor(4) as ex:%0A        for i in ex.map(bar, xrange(4)):%0A            print i%0A    raise RuntimeError(%22Exception not caught%22)%0A%0A%0Adef main_ProcessPoolExecutorSubmit():%0A    with ProcessPoolExecutor(4) as ex:%0A        s = ex.submit(bar, 0)%0A        print s.result()%0A    raise RuntimeError(%22Exception not caught%22)%0A%0A%0Adef run(fun):%0A    ac = threading.active_count()%0A    try:%0A        fun()%0A    except RuntimeError:%0A        print fun.__name__, %22%5BNOT raised%5D%22%0A    except ValueError:%0A        print fun.__name__, %22%5BRAISED%5D%22%0A    time.sleep(1)%0A    print %22Zombie thread:%22, threading.active_count() - ac%0A%0Aif __name__ == '__main__':%0A    run(main_Thread)%0A    run(main_ThreadPool)%0A    run(main_ThreadPoolExecutorMap)%0A    run(main_ThreadPoolExecutorSubmit)%0A    run(main_Process)%0A    run(main_ProcessPool)%0A    run(main_ProcessPoolExecutorMap)%0A    run(main_ProcessPoolExecutorSubmit)%0A

Add concurrent futures benchmark script