ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/win_process.c
(Generate patch)

Comparing ray/src/common/win_process.c (file contents):
Revision 3.4 by schorsch, Tue Oct 21 19:19:28 2003 UTC vs.
Revision 3.5 by schorsch, Sat Oct 23 18:55:52 2004 UTC

# Line 287 | Line 287 | open_process(SUBPROC *proc, char *av[])
287   }
288  
289  
290 + int win_kill(RT_PID pid, int sig) /* we ignore sig... */
291 + {
292 +        HANDLE hProc;
293 +
294 +        hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, pid);
295 +        /*  it looks like we want to ignore errors here */
296 +        if(hProc != NULL) {
297 + #ifdef OBSOLETE_WINDOWS
298 + #define KILL_TIMEOUT 10 * 1000 /* milliseconds */
299 +                /* it might have some windows open... */
300 +                EnumWindows((WNDENUMPROC)TerminateAppEnum, (LPARAM)pid);
301 +                if(WaitForSingleObject(hProc, KILL_TIMEOUT)!=WAIT_OBJECT_0) {
302 +                        /* No way to avoid dangling DLLs here. */
303 +                        TerminateProcess(hProc, 0);
304 +                }
305 + #else
306 +                SafeTerminateProcess(hProc, 0);
307 + #endif
308 +                /* WaitForSingleObject(hProc, 0); */
309 +                /* not much use to wait on Windows */
310 +                CloseHandle(hProc);
311 +        }
312 +        return 0; /* XXX we need to figure out more here... */
313 + }
314 +
315 +
316   int
317   close_process(SUBPROC *proc) {
318          int icres, ocres;
319          DWORD pid;
294        HANDLE hProc;
320  
321          ocres = close(proc->w);
322          icres = close(proc->r);
323          pid = proc->pid;
324          if(ocres != 0 || icres != 0) {
300                hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, pid);
325                  /* something went wrong: enforce infanticide */
326                  /* other than that, it looks like we want to ignore errors here */
327                  if (proc->running) {
328 <                        if(hProc != NULL) {
305 < #ifdef OBSOLETE_WINDOWS
306 < #define KILL_TIMEOUT 10 * 1000 /* milliseconds */
307 <                                /* it might have some windows open... */
308 <                                EnumWindows((WNDENUMPROC)TerminateAppEnum, (LPARAM)pid);
309 <                                if(WaitForSingleObject(hProc, KILL_TIMEOUT)!=WAIT_OBJECT_0) {
310 <                                        /* No way to avoid dangling DLLs here. */
311 <                                        TerminateProcess(hProc, 0);
312 <                                }
313 < #else
314 <                                SafeTerminateProcess(hProc, 0);
315 < #endif
316 <                                /* WaitForSingleObject(hProc, 0); */
317 <                                /* not much use to wait on Windows */
318 <                                CloseHandle(hProc);
319 <                        }
328 >                        int win_kill(pid, 0);
329                  }
330          }
331          proc->running = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines