07 线程池回调函数

import time
from threading import current_thread
from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor

def f1(n,s):
    return n+s

def f2(n):

    print('回调函数>>>',n.result())
if __name__ == '__main__':

    tp = ThreadPoolExecutor(4)

    res = tp.submit(f1,11,12).add_done_callback(f2)

    # print(res.result())

 

posted on 2019-01-14 15:53  =.===  阅读(236)  评论(0编辑  收藏  举报

导航