-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))
但这并不奏效。该程序在第二次提交时挂起。为什么?