[66807] trunk/base/src/port1.0/porttrace.tcl

raimue at macports.org raimue at macports.org
Thu Apr 22 19:44:14 PDT 2010


Revision: 66807
          http://trac.macports.org/changeset/66807
Author:   raimue at macports.org
Date:     2010-04-22 19:44:13 -0700 (Thu, 22 Apr 2010)
Log Message:
-----------
porttrace:
Run slave_init synchronous, fixing a race condition where the darwintrace
connect could be faster than the tracelib initialization.

Modified Paths:
--------------
    trunk/base/src/port1.0/porttrace.tcl

Modified: trunk/base/src/port1.0/porttrace.tcl
===================================================================
--- trunk/base/src/port1.0/porttrace.tcl	2010-04-23 02:40:01 UTC (rev 66806)
+++ trunk/base/src/port1.0/porttrace.tcl	2010-04-23 02:44:13 UTC (rev 66807)
@@ -174,12 +174,15 @@
     set trace_thread [macports_create_thread]
 
     # The slave thread requires the registry package.
-    thread::send -async $trace_thread "package require registry 1.0"
+    thread::send $trace_thread "package require registry 1.0"
     # and this file as well.
-    thread::send -async $trace_thread "package require porttrace 1.0"
+    thread::send $trace_thread "package require porttrace 1.0"
 
-    # Start the slave work.
-    thread::send -async $trace_thread "porttrace::slave_start $trace_fifo $workpath"
+    # Initialize the slave
+    thread::send $trace_thread "porttrace::slave_init $trace_fifo $workpath"
+
+    # Run slave asynchronously
+    thread::send -async $trace_thread "porttrace::slave_run"
 }
 
 # Private
@@ -273,7 +276,7 @@
 
 # Private.
 # Slave init method.
-proc porttrace::slave_start {fifo p_workpath} {
+proc porttrace::slave_init {fifo p_workpath} {
     global ports_list trace_filemap sandbox_violation_list
     # Save the workpath.
     set workpath $p_workpath
@@ -282,8 +285,19 @@
     set ports_list {}
     set sandbox_violation_list {}
     tracelib setname $fifo
+
+    if [catch {tracelib opensocket} err] {
+        global errorInfo
+        ui_warn "Error in tracelib: $err"
+        ui_debug "Backtrace: $errorInfo"
+    }
+}
+
+proc porttrace::slave_run {} {
     if [catch {tracelib run} err] {
+        global errorInfo
         ui_warn "Error in tracelib: $err"
+        ui_debug "Backtrace: $errorInfo"
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100422/cf0aa959/attachment.html>


More information about the macports-changes mailing list