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.12 by schorsch, Sun Mar 6 01:13:17 2016 UTC vs.
Revision 3.13 by schorsch, Mon Mar 28 16:59:38 2016 UTC

# Line 38 | Line 38 | win_nice(int inc) /* simple nice(2) replacement for Wi
38      in the process that calls ExitProcess.
39          As presented by Andrew Tucker in Windows Developer Magazine.
40   */
41 #ifndef OBSOLETE_WINDOWS  /* won't work on Win 9X/ME/CE. */
41   BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode)
42   {
43          DWORD dwTID, dwCode, dwErr = 0;
# Line 78 | Line 77 | BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitC
77          if ( !bSuccess ) SetLastError(dwErr);
78          return bSuccess;
79   }
81 #endif
80  
81  
82   static int
# Line 300 | Line 298 | int win_kill(RT_PID pid, int sig) /* we ignore sig...
298          hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, pid);
299          /*  it looks like we want to ignore errors here */
300          if(hProc != NULL) {
303 #ifdef OBSOLETE_WINDOWS
304 #define KILL_TIMEOUT 10 * 1000 /* milliseconds */
305                /* it might have some windows open... */
306                EnumWindows((WNDENUMPROC)TerminateAppEnum, (LPARAM)pid);
307                if(WaitForSingleObject(hProc, KILL_TIMEOUT)!=WAIT_OBJECT_0) {
308                        /* No way to avoid dangling DLLs here. */
309                        TerminateProcess(hProc, 0);
310                }
311 #else
301                  SafeTerminateProcess(hProc, 0);
313 #endif
314                /* WaitForSingleObject(hProc, 0); */
315                /* not much use to wait on Windows */
302                  CloseHandle(hProc);
303          }
304          return 0; /* XXX we need to figure out more here... */
# Line 331 | Line 317 | close_processes(SUBPROC pd[], int nproc) {
317                          pd[i].running = 0;
318                          if(ocres != 0 || icres != 0) {
319                                  /* something went wrong: enforce infanticide */
320 <                                /* other than that, it looks like we want to ignore errors here */
320 >                                /* other than that, it looks like we want to ignore errors */
321                                  win_kill(pd[i].pid, 0);
322                          }
323                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines