Skip to content

Commit f40a547

Browse files
committed
process ID (pid) getter interface
1 parent 06c7136 commit f40a547

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

example/system/example_process_5.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ program example_process_5
2020

2121
end do
2222

23-
print *, "Process ",process%id," completed in ",process%elapsed()," seconds."
23+
print *, "Process ",process%pid()," completed in ",process%elapsed()," seconds."
2424

2525
end program example_process_5

src/stdlib_system.F90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ module stdlib_system
6969
!! Kill a process
7070
procedure :: kill => process_kill
7171

72+
!! Get process ID
73+
procedure :: pid => process_get_ID
74+
7275
end type process_type
7376

7477
interface runasync
@@ -363,6 +366,10 @@ end subroutine sleep
363366
module logical function is_windows()
364367
end function is_windows
365368

369+
module integer(process_ID) function process_get_ID(process) result(ID)
370+
class(process_type), intent(in) :: process
371+
end function process_get_ID
372+
366373
end interface
367374

368375
end module stdlib_system

src/stdlib_system_subprocess.F90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,4 +706,10 @@ function getfile(fileName,err,delete) result(file)
706706

707707
end function getfile
708708

709+
!> Return process ID
710+
integer(procesS_ID) function process_get_ID(process) result(ID)
711+
class(process_type), intent(in) :: process
712+
ID = process%id
713+
end function process_get_ID
714+
709715
end submodule stdlib_system_subprocess

0 commit comments

Comments
 (0)