summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2005-11-08 18:43:37 +0000
committerfche <fche>2005-11-08 18:43:37 +0000
commit1a0e4851043eb5679543c7779b00e3d925e83004 (patch)
tree4b4f9bd1fdfe271c8a0d20884331df94ea6bfe50
parent28776e58055246efc0083d05648eaf2e97b04644 (diff)
downloadsystemtap-steved-1a0e4851043eb5679543c7779b00e3d925e83004.tar.gz
systemtap-steved-1a0e4851043eb5679543c7779b00e3d925e83004.tar.xz
systemtap-steved-1a0e4851043eb5679543c7779b00e3d925e83004.zip
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. :-(
-rw-r--r--ChangeLog6
-rw-r--r--translate.cxx19
2 files changed, 17 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index a9b4bc54..ef0fca5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
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.
2005-11-08 Frank Ch. Eigler <fche@redhat.com>
diff --git a/translate.cxx b/translate.cxx
index 95a37438..799cf8d8 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -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