|
Boost-Build : |
From: Bronek Kozicki (brok_at_[hidden])
Date: 2006-06-19 09:37:28
Bronek Kozicki wrote:
> Bronek Kozicki wrote:
>> (blush) oh, wait. There might be better fix for this. I will see today
>> and send another diff if it works :)
> pls. apply attached diff to boost/tools/jam/src/execnt.c in both branches:
Now I believe that waiting for dialog message pump thread to terminate is more
reasonable that waiting for the whole process. Thus instead of
WaitForSingleObject(h, 500) there should be WaitForSingleObject(tid, 500). I
did not test that, though. I will report to you later (end of week) when I
know for sure if it still works (or you might test it?). Sorry for sending so
many versions of the same fix :-//
B.
--- C:\Documents and Settings\Bronek Kozicki\Desktop\execnt.c Sat Jun 17 11:04:58 2006 UTC
+++ E:\DEVEL\BOOST_RTEST\boost\tools\jam\src\execnt.c Sat Jun 17 11:13:43 2006 UTC
@@ -1016,9 +1016,12 @@
ok == TRUE;
ok = Process32Next(process_snapshot_h, &pinfo) )
{
if (pinfo.th32ProcessID == child && pinfo.th32ParentProcessID)
+ {
+ CloseHandle(process_snapshot_h);
return is_parent_child(parent, pinfo.th32ParentProcessID);
+ }
}
CloseHandle(process_snapshot_h);
}
@@ -1035,20 +1038,30 @@
{
char buf[10] = {0};
HANDLE h = *((HANDLE*) (lParam));
DWORD pid = 0;
+ DWORD tid = 0;
if (!GetClassNameA(hwnd, buf, 10))
- return TRUE; // failed to read class name
+ return TRUE; /* failed to read class name; presume it's not a dialog */
if (strcmp(buf, "#32770"))
- return TRUE; // not a dialog
+ return TRUE; /* not a dialog */
- GetWindowThreadProcessId(hwnd, &pid);
+ tid = GetWindowThreadProcessId(hwnd, &pid);
if (related(h, pid))
{
- PostMessage(hwnd, WM_QUIT, 0, 0);
- // just one window at a time
+ /* ask really nice */
+ PostMessageA(hwnd, WM_CLOSE, 0, 0);
+ /* now wait and see if it worked. If not, insist */
+ if (WaitForSingleObject(tid, 500) == WAIT_TIMEOUT)
+ {
+ PostThreadMessageA(tid, WM_QUIT, 0, 0);
+ if (WaitForSingleObject(tid, 500) == WAIT_TIMEOUT)
+ {
+ PostThreadMessageA(tid, WM_QUIT, 0, 0);
+ }
+ }
return FALSE;
}
return TRUE;
@@ -1104,13 +1117,13 @@
/* check if any jobs have surpassed the maximum run time. */
for ( i = 0; i < num_active; ++i )
{
double t = running_time(active_handles[i]);
+ /* the job may have left an alert dialog around,
+ try and get rid of it before killing */
+ close_alert(active_handles[i]);
if ( t > (double)globs.timeout )
{
- /* the job may have left an alert dialog around,
- try and get rid of it before killing */
- close_alert(active_handles[i]);
/* we have a "runaway" job, kill it */
kill_all(0,active_handles[i]);
/* indicate the job "finished" so we query its status below */
waitcode = WAIT_ABANDONED_0+i;
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk