Revision: 41466
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41466&view=rev
Author:   brlcad
Date:     2010-11-25 05:48:16 +0000 (Thu, 25 Nov 2010)

Log Message:
-----------
document the timer complexity a little bit explaining why things are as 
complicated as they are.  pushing the limits of shell scripting.

Modified Paths:
--------------
    brlcad/trunk/sh/conversion.sh

Modified: brlcad/trunk/sh/conversion.sh
===================================================================
--- brlcad/trunk/sh/conversion.sh       2010-11-25 05:37:48 UTC (rev 41465)
+++ brlcad/trunk/sh/conversion.sh       2010-11-25 05:48:16 UTC (rev 41466)
@@ -377,7 +377,12 @@
            continue
        fi
 
-       # start the limit timer
+       # start the limit timer.  this will kill the upcoming facetize
+       # job if more than MAXTIME seconds have elapsed.  in order for
+       # this to work while still ECHO'ing a message and without
+       # leaving orphaned 'sleep' processes that accumualte, this
+       # method had to be executed in the current shell environment.
+
        { sleep $MAXTIME && test "x`ps auxwww | grep "$work" | grep facetize | 
grep "${obj}.nmg" | awk '{print $2}'`" != "x" && $ECHO "\tNMG conversion time 
limit exceeded: $file:$object" && kill -9 `ps auxwww | grep "$work" | grep 
facetize | grep "${obj}.nmg" | awk '{print $2}'` 2>&4 & } 4>&2 2>/dev/null
         spid=$!
 
@@ -387,6 +392,12 @@
        $VERBOSE_ECHO "\$ $cmd"
        output=`eval time $cmd 2>&1 | grep -v Using`
 
+       # stop the limit timer.  when we get here, see if there is a
+       # sleep process still running.  if any found, the sleep
+       # proceses are killed and waited for so that we successfully
+       # avoid the parent shell reporting a "Terminated" process kill
+       # message.
+
        for pid in `ps xj | grep $spid | grep sleep | grep -v grep | awk 
'{print $2}'` ; do
            # must kill sleep children first or they can continue running 
orphaned
            kill $pid >/dev/null 2>&1
@@ -406,7 +417,7 @@
            nmg_count=`expr $nmg_count + 1`
        fi
 
-       # start the limit timer
+       # start the limit timer, same as above.
        { sleep $MAXTIME && test "x`ps auxwww | grep "$work" | grep facetize | 
grep "${obj}.bot" | awk '{print $2}'`" != "x" && $ECHO "\tBoT conversion time 
limit exceeded: $file:$object" && kill -9 `ps auxwww | grep "$work" | grep 
facetize | grep "${obj}.bot" | awk '{print $2}'` 2>&4 & } 4>&2 2>/dev/null
         spid=$!
 
@@ -416,6 +427,7 @@
        $VERBOSE_ECHO "\$ $cmd"
        output=`eval time $cmd 2>&1 | grep -v Using`
 
+       # stop the limit timer, same as above.
        for pid in `ps xj | grep $spid | grep sleep | grep -v grep | awk 
'{print $2}'` ; do
            # must kill sleep children first or they can continue running 
orphaned
            kill $pid >/dev/null 2>&1


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to