1.waitpid
pid_t waitpid(pid_t pid, int *wstatus, int options);
功能:
回收指定的子进程空间
参数:
pid:要回收的子进程的pid
wstatus:回收状态的指针
options:回收选项
0 阻塞回收
WNOHANG:非阻塞回收
返回值:
成功:返回回收的子进程的pid
失败:返回-1
2.exec函数族:
extern char **environ;
int execl(const char *path, const char *arg, .../* (char *) NULL */);
int execlp(const char *file, const char *arg, .../* (char *) NULL */);
int execle(const char *path, const char *arg, .../*, (char *) NULL, char * const envp[] */);
int execv(const char *path, char *const argv[]);
int execvp(const char *file, char *const argv[]);
int execvpe(const char *file, char *const argv[], char *const envp[]);
4.pthread_join
注*:pthread_join具有阻塞功能,线程不结束,会阻塞等到直到线程结束回收线程空间
pthread_join具有同步功能