【发布时间】:2013-09-13 12:50:43
【问题描述】:
我正在运行一些 C++ 代码(在 8 个内核的 Ubuntu 上运行的 8 个独立进程)。
我正在使用 python 启动 C 进程:
def runC():
numThreads = multiprocessing.cpu_count()
threads = []
for i in range(numThreads):
args = ("./cprogram", arg1,arg2,arg3)
popen = subprocess.Popen(args, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
threads.append(popen)
for t in threads:
t.wait()
output = t.stdout.read()
err = t.stderr.read()
if len(output) > 0:
print "output: " + output
if len(err) > 0:
print "err: " + err
我不断收到“失效”的进程。这意味着什么?为什么这会发生在我身上?
【问题讨论】:
-
这太模糊了,甚至不知道您在说什么,更不用说回答任何问题了。能不能给个更详细的说明。
-
感谢@PaulEvans ;) 我已经详细说明了。