Skip to content

Commit 136b5b8

Browse files
committed
remove unused process handle
1 parent 237e9ff commit 136b5b8

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

src/stdlib_system.F90

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module stdlib_system
22
use, intrinsic :: iso_c_binding, only : c_int, c_long, c_null_ptr, c_int64_t
3-
use, intrinsic :: iso_c_binding, only : process_handle => c_ptr, null_process => c_null_ptr
43
use stdlib_kinds, only: int64, dp
54
implicit none
65
private
@@ -27,12 +26,11 @@ module stdlib_system
2726
! Default flag for the runner process
2827
integer(process_ID), parameter, private :: FORKED_PROCESS = 0_process_ID
2928

30-
! Public type to describe a process
29+
!> Process type holding process information and the connected stdout, stderr, stdin units
3130
type :: process_type
3231

3332
!> Process ID (if external); 0 if run by the program process
3433
integer(process_ID) :: id = FORKED_PROCESS
35-
type(process_handle) :: handle = null_process
3634

3735
!> Process is completed
3836
logical :: completed = .false.

src/stdlib_system_subprocess.F90

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,15 @@ subroutine process_query_status(pid, wait, is_running, exit_code) &
3030
integer(c_int), intent(out) :: exit_code
3131
end subroutine process_query_status
3232

33-
subroutine process_create(cmd, stdin_stream, stdin_file, stdout_file, stderr_file, handle, pid) &
33+
subroutine process_create(cmd, stdin_stream, stdin_file, stdout_file, stderr_file, pid) &
3434
bind(C, name='process_create')
35-
import c_char, process_handle, process_ID
35+
import c_char, process_ID
3636
implicit none
3737
character(c_char), intent(in) :: cmd(*)
3838
character(c_char), intent(in), optional :: stdin_stream(*)
3939
character(c_char), intent(in), optional :: stdin_file(*)
4040
character(c_char), intent(in), optional :: stdout_file(*)
4141
character(c_char), intent(in), optional :: stderr_file(*)
42-
type(process_handle), intent(out) :: handle
4342
integer(process_ID), intent(out) :: pid
4443
end subroutine process_create
4544

@@ -185,7 +184,7 @@ subroutine launch_asynchronous(process, args, stdin)
185184

186185
! On Windows, this 1) creates 2) launches an external process from C.
187186
! On unix, this 1) forks an external process
188-
call process_create(c_cmd, c_stdin, c_stdin_file, c_stdout_file, c_stderr_file, process%handle, process%id)
187+
call process_create(c_cmd, c_stdin, c_stdin_file, c_stdout_file, c_stderr_file, process%id)
189188

190189
end subroutine launch_asynchronous
191190

src/stdlib_system_subprocess.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ typedef int64_t stdlib_pid;
2828
// On Windows systems: create a new process
2929
void process_create_windows(const char* cmd, const char* stdin_stream,
3030
const char* stdin_file, const char* stdout_file, const char* stderr_file,
31-
stdlib_handle* handle, stdlib_pid* pid) {
31+
stdlib_pid* pid) {
3232

3333
STARTUPINFO si;
3434
PROCESS_INFORMATION pi;
@@ -37,7 +37,6 @@ void process_create_windows(const char* cmd, const char* stdin_stream,
3737
FILE* stdin_fp = NULL;
3838

3939
// Initialize null handle
40-
(*handle) = NULL;
4140
(*pid) = 0;
4241

4342
ZeroMemory(&si, sizeof(si));
@@ -112,7 +111,6 @@ void process_create_windows(const char* cmd, const char* stdin_stream,
112111

113112
// Return the process handle for status queries
114113
CloseHandle(pi.hThread); // Close the thread handle
115-
(*handle) = (stdlib_handle) pi.hProcess; // Return the process handle
116114
(*pid) = (stdlib_pid) pi.dwProcessId;
117115

118116
}
@@ -257,10 +255,9 @@ bool process_kill_unix(int pid) {
257255

258256

259257
// On UNIX systems: just fork a new process. The command line will be executed from Fortran.
260-
void process_create_posix(stdlib_handle* handle, stdlib_pid* pid)
258+
void process_create_posix(stdlib_pid* pid)
261259
{
262260

263-
(*handle) = NULL;
264261
(*pid) = (stdlib_pid) fork();
265262
}
266263

@@ -273,11 +270,11 @@ void process_create_posix(stdlib_handle* handle, stdlib_pid* pid)
273270
// Create or fork process
274271
void process_create(const char* cmd, const char* stdin_stream, const char* stdin_file,
275272
const char* stdout_file, const char* stderr_file,
276-
stdlib_handle* handle, stdlib_pid* pid) {
273+
stdlib_pid* pid) {
277274
#ifdef _WIN32
278-
process_create_windows(cmd, stdin_stream, stdin_file, stdout_file, stderr_file, handle, pid);
275+
process_create_windows(cmd, stdin_stream, stdin_file, stdout_file, stderr_file, pid);
279276
#else
280-
process_create_posix(handle, pid);
277+
process_create_posix(pid);
281278
#endif // _WIN32
282279
}
283280

0 commit comments

Comments
 (0)