from multiprocessing.pool import Pool
from multiprocessing import current_process
def test_func():
print("process = " + current_process().name)
return current_process().name
def call_back(result):
print("callack = " + current_process().name)
return current_process().name
if __name__ == "__main__":
current_process().name = "MainThread"
pool = Pool(processes=5)
result = pool.apply_async(test_func, callback=call_back).get()
>> callack = MainThread
Спасибо! Кажется, это и есть Objective-C аналог, который я давно искал :)