Closed
Description
If a task fails, and then during the unwind some code in a destructor calls write
on a RWArc
, the RWArc
is poisoned. I think this is a bug. I would expect a failure that happened during one of the closures passed to write
to poison it, but not a call to write
that happened within a destructor during an unwind from a failure that had already occurred.
Here is some sample code that exhibits the problem--it gives the error message 'Poisoned rw_arc - another task failed inside!'
whereas I would expect it to print 5
:
extern mod extra;
use extra::arc::RWArc;
use std::task;
struct Unwinder{ i: RWArc<int> }
impl Drop for Unwinder {
fn drop(&mut self) {
self.i.write(|num| {*num += 3;});
}
}
fn main() {
let a = RWArc::<int>::new(2);
let a_copy = a.clone();
do task::try::<()> {
let _u = Unwinder{i:a_copy};
fail!();
};
a.write(|num| { println!("{:d}", *num); });
}
Metadata
Metadata
Assignees
Labels
No labels