考虑这个EXECL中分离线程 - 查杀方法(C++ STD 11)
#include <cstdio>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <vector>
#include <string>
#include <iterator>
#include <cmath>
#include <thread>
#include <cerrno>
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <boost/algorithm/string.hpp>
#include "utils.cpp"
#include "pstream.h"
//pstream is the process stream library as below
void doThings()
{
while(not exitflag, a global){
if(some condition) {execl (a bash script); std:cout << "this text will never get printed, process ends at execl" <<endl;}
}}}
int main()
{//detach doThings as a thread here
}
我可以保证的是,全球exitflag没有设置,也将被印在std ::法院线,甚至标志被设置,因为在打印信息之前,没有命令可以中断并跳到结尾,以便解除终止。
我做错了什么?顺便说一句:shell脚本运行完美。
编辑:(感谢MiniTech移动)我不想原单程序死
并行线程:http://sourceforge.net/projects/pstreams/files/pstreams/Release%200.8.x/
我不知道你在问什么。你能否展示你得到的结果和你期望的结果? – Ryan