Closing a handle to a child processΒΆ

close_handle()

Close a handle to a child process


SYNTAX

close_handle(server_name, child_handle )

Close a handle. The handle to a child process must be closed when no longer needed, or resources remain allocated to the task even though it has exited.

The child process is executed by means of the execute() function. Child processes can also be executed by the exec command, but in this case no handle is returned and close_handle() is irrelevant.

server_name

The name of the server on which the child process was run. This value should be set to NULL or to a null string if the task was a local process.

child_handle

A field containing the handle. The handle is the return value from the execute() function call that started the child process, and should be stored in an i4 type field.

The close_handle function sets the field child_handle to -1, for safety. If the program were to attempt to use the handle after closing it, some unknown effect or a GPF could occur.


EXAMPLE

!temp Handle,,i4

    tmp.Handle = execute("mainserver", "-srepwc prog2", NULL, 0, AA_SHOWNORMAL)
    ...
    end_process("mainserver", tmp.Handle, 4)
    close_handle("mainserver", tmp.Handle)

RELATED TOPICS

end_process()

execute()

exitcode()

exec