]> sourceware.org Git - systemtap.git/commitdiff
2005-11-08 Frank Ch. Eigler <fche@redhat.com>
authorfche <fche>
Tue, 8 Nov 2005 18:43:37 +0000 (18:43 +0000)
committerfche <fche>
Tue, 8 Nov 2005 18:43:37 +0000 (18:43 +0000)
* translate.cxx (c_unparser::visit_foreach_loop): With PR 1275
done, add back read lock around foreach loop.  Add a write lock
around preceding sort operation.  Leave a race condition window. :-(

ChangeLog
translate.cxx

index a9b4bc54c986d2bfc86558a0db402b4c10cf6751..ef0fca5b5933f7521c1f196fc55e5935d92ed70c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-08  Frank Ch. Eigler  <fche@redhat.com>
+
+       * translate.cxx (c_unparser::visit_foreach_loop): With PR 1275
+       done, add back read lock around foreach loop.  Add a write lock
+       around preceding sort operation.  Leave a race condition window. :-(
+
 2005-11-08  Frank Ch. Eigler  <fche@redhat.com>
 
        * translate.cxx (mapvar::exists): Correct some more.
index 95a37438eae8da8750ed67eb7f56c7d4c175f05e..799cf8d8e2b59ed4e2c2b3ebe3c76704b0303d37 100644 (file)
@@ -1648,18 +1648,21 @@ c_unparser::visit_foreach_loop (foreach_loop *s)
 
   // initialization
 
-  // XXX: until bug #1275 is fixed, any reference into a foreach()-iterated
-  // array is an instant deadlock.  For now, don't lock around foreach(),
-  // and hope that no concurrent probe handler will modify this array.
-  //
-  // varlock_r guard (*this, mv);
-
   // sort array if desired
   if (s->sort_direction)
-    o->newline() << "_stp_map_sort (" << mv.qname() << ", "
-                << s->sort_column << ", " << - s->sort_direction << ");";
+    {
+      varlock_w sort_guard (*this, mv);
+      o->newline() << "_stp_map_sort (" << mv.qname() << ", "
+                   << s->sort_column << ", " << - s->sort_direction << ");";
+    }
   // NB: sort direction sense is opposite in runtime, thus the negation
 
+  // XXX: There is a race condition here.  Since we can't convert a
+  // write lock to a read lock, it is possible that another sort or update
+  // may get sandwiched between the release of sort_guard and the
+  // acquisition of guard.
+
+  varlock_r guard (*this, mv);
   o->newline() << iv << " = " << iv.start (mv) << ";";
 
   // condition
This page took 0.048723 seconds and 5 git commands to generate.