diff options
Diffstat (limited to 'translate.cxx')
-rw-r--r-- | translate.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
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 |