Don't use unkillable in UnsafeArc dtor when there's no unwrapper. Close #8382.
This commit is contained in:
parent
ecfc9a8223
commit
ee5cfb0c2d
@ -229,7 +229,6 @@ impl<T> Drop for UnsafeAtomicRcBox<T>{
|
|||||||
if self.data.is_null() {
|
if self.data.is_null() {
|
||||||
return; // Happens when destructing an unwrapper's handle.
|
return; // Happens when destructing an unwrapper's handle.
|
||||||
}
|
}
|
||||||
do task::unkillable {
|
|
||||||
let mut data: ~AtomicRcBoxData<T> = cast::transmute(self.data);
|
let mut data: ~AtomicRcBoxData<T> = cast::transmute(self.data);
|
||||||
// Must be acquire+release, not just release, to make sure this
|
// Must be acquire+release, not just release, to make sure this
|
||||||
// doesn't get reordered to after the unwrapper pointer load.
|
// 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.
|
// *awake* task with the data.
|
||||||
match data.unwrapper.take(Acquire) {
|
match data.unwrapper.take(Acquire) {
|
||||||
Some(~(message,response)) => {
|
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.
|
// Send 'ready' and wait for a response.
|
||||||
message.send(());
|
message.send(());
|
||||||
// Unkillable wait. Message guaranteed to come.
|
// Unkillable wait. Message guaranteed to come.
|
||||||
@ -253,6 +255,7 @@ impl<T> Drop for UnsafeAtomicRcBox<T>{
|
|||||||
// Other task was killed. drop glue takes over.
|
// Other task was killed. drop glue takes over.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
None => {
|
None => {
|
||||||
// drop glue takes over.
|
// drop glue takes over.
|
||||||
}
|
}
|
||||||
@ -263,7 +266,6 @@ impl<T> Drop for UnsafeAtomicRcBox<T>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user