当前位置: 首页 > 文档资料 > Perl 入门教程 >

waitpid

优质
小牛编辑
117浏览
2023-12-01

描述 (Description)

此函数等待具有ID PID的子进程终止,返回已故进程的进程ID。 如果PID不存在,则返回-1。 该流程的退出状态包含在$?中。

可以将标志设置为各种值,这些值等同于waitpid()UNIX系统调用所使用的值。 FLAGS的值0应适用于支持进程的所有操作系统。

语法 (Syntax)

以下是此函数的简单语法 -

waitpid PID, FLAGS

返回值 (Return Value)

如果进程不存在,则此函数返回-1否则已故进程的进程ID。

<!--

例子 (Example)

Following is the example code showing its basic usage −

When above code is executed, it produces the following result −

-->