-1
如果我的所有進程都是從不同的函數啓動的,那麼使用concurrent.futures是沒有問題的。但如果我想用不同的參數調用相同的函數,我似乎無法獲得正確的語法。這是我得到了這麼遠,但它不工作:Python concurrent.futures調用相同的函數兩次
tasks = ((serial_port_local, serial_options_local, serial_port_remote, serial_options_remote, "local"),
(serial_port_remote, serial_options_remote, serial_port_local, serial_options_local, "remote"))
for task in zip(tasks, executor.map(serial_cross_over, tasks)):
print (task)
這是錯誤,但我不神交它:
TypeError: serial_cross_over() missing 4 required positional arguments: 'receive_serial_options', 'send_serial_port', 'send_serial_options', and 'source'
其實我真的不神交爲什麼它的複雜在所有。我不應該只能這樣做:
executor.submit(some_function(parameter1))
executor.submit(some_function(parameter2))
但這並不奏效。該程序在第二次提交時掛起。爲什麼?