Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

PXFWIFEXITED

POSIX Function: Determines if a child process has exited. This routine is only available for Linux.

Module

USE IFPOSIX

result = PXFWIFEXITED (istat)

istat

(Output) INTEGER(4). The status of the child process (obtained from PXFWAIT or PXFWAITPID).

Results

The result type is logical. The result value is .TRUE. if the child process has exited normally; otherwise, .FALSE..

Example

program t1  
use ifposix  
integer(4) ipid, istat, ierror, ipid_ret, istat_ret
  print *," the child process will be born"
  call PXFFORK(IPID, IERROR)
  call PXFGETPID(IPID_RET,IERROR)
  if(IPID.EQ.0) then
     print *," I am a child process"
     print *," My child's pid is", IPID_RET
     call PXFGETPPID(IPID_RET,IERROR)
     print *," The pid of my parent is",IPID_RET
     print *," Now I have exited with code 0xABCD"
     call PXFEXIT(Z'ABCD')
  else
     print *," I am a parent process"
     print *," My parent pid is ", IPID_RET
     print *," I am creating the process with pid", IPID
     print *," Now I am waiting for the end of the child process"
     call PXFWAIT(ISTAT, IPID_RET, IERROR)
     print *," The child with pid ", IPID_RET," has exited"
     if( PXFWIFEXITED(ISTAT) ) then
       print *, " The child exited normally"
       istat_ret = IPXFWEXITSTATUS(ISTAT)
       print 10," The low byte of the child exit code is", istat_ret
     end if  
  end if
10 FORMAT (A,Z)  
end program