Correctly halts
This commit is contained in:
@@ -51,14 +51,24 @@ impl ExprHandle {
|
||||
/// Drop one instance of the handle silently; if it's the last one, do
|
||||
/// nothing, otherwise send an Acquire
|
||||
pub async fn drop_one(self: Rc<Self>) {
|
||||
if let Err(rc) = Rc::try_unwrap(self) {
|
||||
rc.ctx.reqnot().notify(api::Acquire(rc.ctx.sys_id(), rc.tk)).await
|
||||
match Rc::try_unwrap(self) {
|
||||
Err(rc) => {
|
||||
eprintln!("Extending lifetime for {:?}", rc.tk);
|
||||
rc.ctx.reqnot().notify(api::Acquire(rc.ctx.sys_id(), rc.tk)).await
|
||||
},
|
||||
Ok(hand) => {
|
||||
// avoid calling destructor
|
||||
hand.destructure();
|
||||
},
|
||||
}
|
||||
}
|
||||
/// Drop the handle and get the ticket without a release notification.
|
||||
/// Use this with messages that imply ownership transfer. This function is
|
||||
/// safe because abusing it is a memory leak.
|
||||
pub fn serialize(self) -> api::ExprTicket { self.destructure().0 }
|
||||
pub fn serialize(self) -> api::ExprTicket {
|
||||
eprintln!("Skipping destructor for {:?}", self.tk);
|
||||
self.destructure().0
|
||||
}
|
||||
}
|
||||
impl Eq for ExprHandle {}
|
||||
impl PartialEq for ExprHandle {
|
||||
|
||||
Reference in New Issue
Block a user