[PATCH 4/4] schedsvc: Periodically check state of the running task instances.

Dmitry Timoshkov dmitry at baikal.ru
Wed May 16 04:47:41 CDT 2018


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/schedsvc/atsvc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c
index 630e634a8f..c63966bdac 100644
--- a/dlls/schedsvc/atsvc.c
+++ b/dlls/schedsvc/atsvc.c
@@ -172,6 +172,25 @@ void check_task_state(void)
                 update_job_status(job);
             }
         }
+        else if (job->instance_count)
+        {
+            DWORD exit_code = STILL_ACTIVE;
+
+            TRACE("checking process %s\n", debugstr_w(job->info.Command));
+
+            if (job->process[job->instance_count - 1])
+                GetExitCodeProcess(job->process[job->instance_count - 1], &exit_code);
+
+            if (exit_code != STILL_ACTIVE)
+            {
+                CloseHandle(job->process[job->instance_count - 1]);
+                job->process[job->instance_count - 1] = NULL;
+                job->data.exit_code = exit_code;
+                job->data.status = SCHED_S_TASK_TERMINATED;
+                job->instance_count--;
+                update_job_status(job);
+            }
+        }
     }
 
     LeaveCriticalSection(&at_job_list_section);
-- 
2.16.3




More information about the wine-devel mailing list