Don't use unkillable in UnsafeArc dtor when there's no unwrapper. Close #8382.

This commit is contained in:
Ben Blum 2013-08-07 20:26:15 -04:00
parent ecfc9a8223
commit ee5cfb0c2d

View File

@ -229,7 +229,6 @@ impl<T> Drop for UnsafeAtomicRcBox<T>{
if self.data.is_null() {
return; // Happens when destructing an unwrapper's handle.
}
do task::unkillable {
let mut data: ~AtomicRcBoxData<T> = cast::transmute(self.data);
// Must be acquire+release, not just release, to make sure this
// doesn't get reordered to after the unwrapper pointer load.
@ -243,6 +242,9 @@ impl<T> Drop for UnsafeAtomicRcBox<T>{
// *awake* task with the data.
match data.unwrapper.take(Acquire) {
Some(~(message,response)) => {
let cell = Cell::new((message, response, data));
do task::unkillable {
let (message, response, data) = cell.take();
// Send 'ready' and wait for a response.
message.send(());
// Unkillable wait. Message guaranteed to come.
@ -253,6 +255,7 @@ impl<T> Drop for UnsafeAtomicRcBox<T>{
// Other task was killed. drop glue takes over.
}
}
}
None => {
// drop glue takes over.
}
@ -263,7 +266,6 @@ impl<T> Drop for UnsafeAtomicRcBox<T>{
}
}
}
}
/****************************************************************************/