1. system启动的子进程回挂起,直到子进程正常退出,或者kill掉。
2. 使用kill命令kill子进程
void *thr_fn1(void *arg){ system("ffmpeg -re -i master.mp4 -c copy -f flv -y /dev/null"); printf("son pro exit\n");}void *thr_fn2(void *arg){ sleep(10); system("ps -ef | grep /dev/null | grep -v grep | cut -c 9-15 | xargs kill -s 9");}int main(){ int err; err = pthread_create(&ntid, NULL, thr_fn1,0); if(err!=0) { printf("can't create thread\n"); exit(1); } err = pthread_create(&ntid, NULL, thr_fn2,0); if(err!=0) { printf("can't create thread\n"); exit(1); } while(1) { sleep(1); } sleep(3); exit(0);}