Changeset 3200 for trunk/src/kWorker/kWorker.c
- Timestamp:
- Mar 28, 2018, 10:32:11 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kWorker/kWorker.c
r3199 r3200 9534 9534 KU32 const g_cSandboxGetProcReplacements = K_ELEMENTS(g_aSandboxGetProcReplacements); 9535 9535 9536 /**9537 * Thread that is spawned by the first terminal kwSandboxCtrlHandler invocation.9538 *9539 * This will wait 5 second in a hope that the main thread will shut down the9540 * process nicly, otherwise it will terminate it forcefully.9541 */9542 static DWORD WINAPI kwSandboxCtrlThreadProc(PVOID pvUser)9543 {9544 int i;9545 for (i = 0; i < 10; i++)9546 {9547 Sleep(500);9548 CancelIoEx(g_hPipe, NULL);9549 }9550 TerminateProcess(GetCurrentProcess(), (int)(intptr_t)pvUser);9551 return -1;9552 }9553 9554 9536 9555 9537 /** … … 9599 9581 /* 9600 9582 * Terminate the process after 5 seconds. 9601 *9602 * We don't want to wait here as the console server will otherwise not9603 * signal the other processes in the console, which is bad for kmk as it9604 * will continue to forge ahead. So, the first time we get here we start9605 * a thread for doing the delayed termination.9606 *9607 9583 * If we get here a second time we just terminate the process ourselves. 9608 9584 * … … 9613 9589 g_rcCtrlC = rc; 9614 9590 WriteFile(GetStdHandle(STD_ERROR_HANDLE), pszMsg, (DWORD)strlen(pszMsg), &cbIgn, NULL); 9615 CancelIoEx(g_hPipe, NULL); /* wake up idle main thread */9616 9591 if (rcPrev == 0) 9617 9592 { 9618 CreateThread(NULL, 0, kwSandboxCtrlThreadProc, (void*)(intptr_t)rc, 0 /*fFlags*/, NULL); 9619 return TRUE; 9593 int i; 9594 for (i = 0; i < 10; i++) 9595 { 9596 CancelIoEx(g_hPipe, NULL); /* wake up idle main thread */ 9597 Sleep(500); 9598 } 9620 9599 } 9621 9600 TerminateProcess(GetCurrentProcess(), rc);
Note:
See TracChangeset
for help on using the changeset viewer.