child 能否在 C、Unix 中执行 waitpid() 和 wait()
Can a child execute waitpid() and wait() in C, Unix
在Unix中,C.在一个fork()
之后,通常跟着一个wait()
或waitpid()
来等待child
终止。但是 child
可以执行 wait()
吗? child
没有_child_
,所以当它执行wait()
时,会发生什么?
子价格没有子进程,因此 wait()
将 return -1。来自手册页:
wait(): on success, returns the process ID of the terminated child;
on error, -1 is returned.
在Unix中,C.在一个fork()
之后,通常跟着一个wait()
或waitpid()
来等待child
终止。但是 child
可以执行 wait()
吗? child
没有_child_
,所以当它执行wait()
时,会发生什么?
子价格没有子进程,因此 wait()
将 return -1。来自手册页:
wait(): on success, returns the process ID of the terminated child; on error, -1 is returned.