等待被迷住了,没有回来
waitpid getting hooked and not returning
我有一个函数调用一个名为driverclear的进程。似乎进程开始了,但它永远不会返回,因为我从未获得进程的输出,也从未收到"进程完成"消息。我做错了什么吗?
void cleanDriver
{
pid_t pid;
if(chmod("./helpers/driverclear", S_IXUSR) == 0)
{
int status = 0;
pid = fork();
if(pid == 0)
{
if(!execl("./helpers/driverclear", "driverclear", (char*) NULL))
{
perror("execl failed.n");
}
}
else
{
printf("Process Starting...");
waitpid(pid, &status, 0);
printf("Process Completen");
}
}
}
我没有使用execl
而是改用system("sh root/helpers/driverclear");
来解决我的问题。
相关文章:
- 为什么我的C#代码在调用回C++COM直到Task时会暂停.等待/线程.加入
- 如何让LLDB在成功时退出,在失败时等待
- 等待整个 omp 块完成,然后再调用第二个函数
- 提升 ASIO - io_service 不要等待连接到线程
- 如何在C++中实现带有packaged_task的异步等待循环?
- 虚假唤醒是否会解锁所有等待线程,甚至是不相关的线程?
- 如何等待窗口隐藏在Qt中?
- 如何在不等待检索的情况下获取C++中的内存位置?
- 等待被迷住了,没有回来
- 等待 WaitForMultipleObjects 窗口中的事件数量可变
- 将对象的字节复制到数组并再次复制回来是否安全
- 如何将文本文件加载到 QListwidget 并将其保存回来
- 一个线程等待多个线程事件
- 等待 qthread 终止的正确方法是什么?
- 不可预测的C++睡眠/等待行为
- Bison/flex 在识别规则后等待输入
- 使用记事本C++打开 txt 文件时无需等待
- 接受函数在发送数据包时等待
- 在Visual Studio中运行/调试C ++时,如何在结束时等待输入
- 对于等待以 std::future wait() 返回的函数的 CPU 使用率或检查标志在循环中休眠一段时间哪个更好?