diff mbox

[Branch,~glcompbench-dev/glcompbench/trunk] Rev 65: GlCompositeBenchmark: Use the first 'sh' child to get the WID.

Message ID 20111205123021.18804.60204.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org Dec. 5, 2011, 12:30 p.m. UTC
------------------------------------------------------------
revno: 65
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
branch nick: trunk
timestamp: Mon 2011-12-05 14:20:15 +0200
message:
  GlCompositeBenchmark: Use the first 'sh' child to get the WID.
  
  This avoids a race condition, where sometimes we capture another, wrong xterm
  child process (eg utempter).
modified:
  src/gl-composite-benchmark


--
lp:glcompbench
https://code.launchpad.net/~glcompbench-dev/glcompbench/trunk

You are subscribed to branch lp:glcompbench.
To unsubscribe from this branch go to https://code.launchpad.net/~glcompbench-dev/glcompbench/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'src/gl-composite-benchmark'
--- src/gl-composite-benchmark	2011-06-23 08:54:28 +0000
+++ src/gl-composite-benchmark	2011-12-05 12:20:15 +0000
@@ -24,9 +24,9 @@ 
 pids=""
 wids=""
 
-get_first_child_of_pid()
+get_first_sh_child_of_pid()
 {
-    ps ax -o pid,ppid | awk -v PID=$1 '$2 == PID { print $1; exit }'
+    ps ax -o pid,ppid,comm | awk -v PID=$1 '$2 == PID && $3 == "sh" { print $1; exit }'
 }
 
 get_wid_from_pid()
@@ -40,7 +40,7 @@ 
     _child_pid=
     while [ -z "$_wid" ]; do
         if [ -z "$_child_pid" ]; then
-            _child_pid=$(get_first_child_of_pid $1)
+            _child_pid=$(get_first_sh_child_of_pid $1)
         fi
         if [ -n "$_child_pid" ]; then
             _wid=$(get_wid_from_pid $_child_pid)