小编use*_*864的帖子

waitpid()的示例正在使用中?

我知道这waitpid()用于等待一个过程完成,但是如何才能完全使用它?

在这里我想做的是,创造两个孩子并等待第一个孩子完成,然后在退出前杀死第二个孩子.

//Create two children
pid_t child1;
pid_t child2;
child1 = fork();

//wait for child1 to finish, then kill child2
waitpid() ... child1 {
kill(child2) }
Run Code Online (Sandbox Code Playgroud)

c fork parent-child waitpid

17
推荐指数
3
解决办法
8万
查看次数

你能"重新启动"Python循环的当前迭代吗?

有没有办法实现这样的事情:

for row in rows:
    try:
        something
    except:
        restart iteration
Run Code Online (Sandbox Code Playgroud)

python iteration for-loop

7
推荐指数
2
解决办法
9085
查看次数

标签 统计

c ×1

for-loop ×1

fork ×1

iteration ×1

parent-child ×1

python ×1

waitpid ×1