@@ -72,7 +72,7 @@ module stdlib_system
72
72
! !
73
73
! ! @note The implementation depends on system-level process management capabilities.
74
74
! !
75
- ! ! #### Procedures
75
+ ! ! #### Methods
76
76
! !
77
77
! ! - `process_open_cmd`: Opens a process using a command string.
78
78
! ! - `process_open_args`: Opens a process using an array of arguments.
@@ -104,28 +104,79 @@ module type(process_type) function process_open_args(args, wait, stdin, want_std
104
104
end function process_open_args
105
105
end interface run
106
106
107
-
108
- ! > Live check if a process is still running
109
107
interface is_running
108
+ ! ! version: experimental
109
+ ! !
110
+ ! ! Checks if an external process is still running.
111
+ ! ! ([Specification](../page/specs/stdlib_system.html#is_running-check-if-a-process-is-still-running))
112
+ ! !
113
+ ! ! ### Summary
114
+ ! ! Provides a method to determine if an external process is still actively running.
115
+ ! !
116
+ ! ! ### Description
117
+ ! !
118
+ ! ! This interface checks the status of an external process to determine whether it is still actively running.
119
+ ! ! It is particularly useful for monitoring asynchronous processes created using the `run` interface.
120
+ ! ! The internal state of the `process_type` object is updated after the call to reflect the current process status.
121
+ ! !
122
+ ! ! @note The implementation relies on system-level process management capabilities.
123
+ ! !
110
124
module logical function process_is_running(process) result(is_running)
125
+ ! > The process object to check.
111
126
class(process_type), intent (inout ) :: process
127
+ ! > Logical result: `.true.` if the process is still running, `.false.` otherwise.
112
128
end function process_is_running
113
129
end interface is_running
114
130
115
- ! > Live check if a process is still running
131
+
116
132
interface is_completed
133
+ ! ! version: experimental
134
+ ! !
135
+ ! ! Checks if an external process has completed execution.
136
+ ! ! ([Specification](../page/specs/stdlib_system.html#is_completed-check-if-a-process-has-completed-execution))
137
+ ! !
138
+ ! ! ### Summary
139
+ ! ! Provides a method to determine if an external process has finished execution.
140
+ ! !
141
+ ! ! ### Description
142
+ ! !
143
+ ! ! This interface checks the status of an external process to determine whether it has finished execution.
144
+ ! ! It is particularly useful for monitoring asynchronous processes created using the `run` interface.
145
+ ! ! The internal state of the `process_type` object is updated after the call to reflect the current process status.
146
+ ! !
147
+ ! ! @note The implementation relies on system-level process management capabilities.
148
+ ! !
117
149
module logical function process_is_completed(process) result(is_completed)
150
+ ! > The process object to check.
118
151
class(process_type), intent (inout ) :: process
152
+ ! > Logical result: `.true.` if the process has completed, `.false.` otherwise.
119
153
end function process_is_completed
120
154
end interface is_completed
121
155
122
- ! > Return process lifetime so far, in seconds
123
156
interface elapsed
157
+ ! ! version: experimental
158
+ ! !
159
+ ! ! Returns the lifetime of a process, in seconds.
160
+ ! ! ([Specification](../page/specs/stdlib_system.html#elapsed-return-process-lifetime-in-seconds))
161
+ ! !
162
+ ! ! ### Summary
163
+ ! ! Provides the total elapsed time (in seconds) since the creation of the specified process.
164
+ ! !
165
+ ! ! ### Description
166
+ ! !
167
+ ! ! This interface returns the total elapsed time (in seconds) for a given process since it was started.
168
+ ! ! If the process is still running, the value returned reflects the time from the creation of the process
169
+ ! ! until the call to this function. Otherwise, the total process duration until completion is returned.
170
+ ! !
124
171
module real (RTICKS) function process_lifetime(process) result(delta_t)
125
- class(process_type), intent (in ) :: process
172
+ ! > The process object for which to calculate elapsed time.
173
+ class(process_type), intent (in ) :: process
174
+ ! > The elapsed time in seconds since the process started.
175
+ real (RTICKS) :: delta_t
126
176
end function process_lifetime
127
177
end interface elapsed
128
178
179
+
129
180
! > Wait until a running process is completed
130
181
interface wait
131
182
module subroutine wait_for_completion (process , max_wait_time )
0 commit comments