Boost logo

Boost-Build :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2006-06-16 09:09:09


Hello guys

could you pls. review and integrate attached diff? There are two fixes:

1. PostMessage(WM_QUIT...) does not always seems to "get through" - I added
code to retry PostMessage twice

2. I moved close_alerts outside of timeout verification. That's the actual
purpose of this whole code - close window when it appears, not when timeout is
expired (it might be hundreds of seconds!). This check is actually pretty
cheap if there are no topmost dialogs displayed on the desktop.

I'm using bjam with these fixes and it finally seems to close pesky error
dialogs (crash reports, assertsion etc.) just when they appear, not touching
any other windows. Obviously it only works when these errors appear on the
same desktop where bjam is running, but there is no workaround (the only
solution is to write service running with LocalSystem priviledges, and indeed
I plan to write such a thing).

B.

--- C:\Documents and Settings\Bronek Kozicki\Desktop\execnt.c Fri Jun 16 12:52:54 2006 UTC
+++ C:\DEVEL\BOOST_RTEST\execnt.c Fri Jun 16 12:56:12 2006 UTC
@@ -1047,6 +1047,12 @@
     if (related(h, pid))
     {
         PostMessage(hwnd, WM_QUIT, 0, 0);
+ if (WaitForSingleObject(h, 1*200) == WAIT_TIMEOUT)
+ {
+ PostMessage(hwnd, WM_QUIT, 0, 0);
+ if (WaitForSingleObject(h, 1*500) == WAIT_TIMEOUT)
+ PostMessage(hwnd, WM_QUIT, 0, 0);
+ }
         // just one window at a time
         return FALSE;
     }
@@ -1105,11 +1111,11 @@
                 for ( i = 0; i < num_active; ++i )
                 {
                     double t = running_time(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]);
+ if ( t > (double)globs.timeout )
+ {
                         /* we have a "runaway" job, kill it */
                         kill_all(0,active_handles[i]);
                         /* indicate the job "finished" so we query its status below */


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