Skip to content

Commit

Permalink
Async cancellation safety
Browse files Browse the repository at this point in the history
Update TODO comments.
  • Loading branch information
tatsuya6502 committed Aug 23, 2023
1 parent 6b045b6 commit 54ab77b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion MIGRATION-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ free some memory), you do not need to call `run_pending_tasks` method.
- To enable it, see [Enabling the thread pool](#enabling-the-thread-pool) for more
details.


#### Enabling the thread pool

To enable the thread pool, do the followings:
Expand Down
10 changes: 6 additions & 4 deletions src/future/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,9 @@ where
}

if self.is_removal_notifier_enabled() {
// TODO: Make this one resumable. (Pass `kl`, `_klg`, `upd_op`
// and `ts`)
// TODO: Async cancellation safety: Make this resumable.
// (NOTE: Move `kl`, `_klg`, `upd_op` and `ts` into the
// Future)
self.inner
.notify_upsert(key, &old_entry, old_last_accessed, old_last_modified)
.await;
Expand Down Expand Up @@ -589,8 +590,9 @@ where
}

if self.is_removal_notifier_enabled() {
// TODO: Make this one resumable. (Pass `kl`, `_klg`, `upd_op`
// and `ts`)
// TODO: Async cancellation safety: Make this resumable.
// (NOTE: Move `kl`, `_klg`, `upd_op` and `ts` into the
// Future)
self.inner
.notify_upsert(key, &old_entry, old_last_accessed, old_last_modified)
.await;
Expand Down
11 changes: 6 additions & 5 deletions src/future/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1432,9 +1432,9 @@ where

let op = WriteOp::Remove(kv);
let hk = self.base.housekeeper.as_ref();
// TODO: If enclosing future is being dropped, save `op` and `now` so
// that we can resume later. (maybe we can send to an unbound mpsc
// channel)
// TODO: Async cancellation safety: If enclosing future is being
// dropped, save `op` and `now` so that we can resume later. (maybe
// we can send to an unbound mpsc channel)
Self::schedule_write_op(&self.base.inner, &self.base.write_op_ch, op, now, hk)
.await
.expect("Failed to remove");
Expand Down Expand Up @@ -1881,8 +1881,9 @@ where

let (op, now) = self.base.do_insert_with_hash(key, hash, value).await;
let hk = self.base.housekeeper.as_ref();
// TODO: If enclosing future is being dropped, save `op` and `now` so that
// we can resume later. (maybe we can send to an unbound mpsc channel)
// TODO: Async cancellation safety: If enclosing future is being dropped,
// save `op` and `now` so that we can resume later. (maybe we can send to an
// unbound mpsc channel)
Self::schedule_write_op(&self.base.inner, &self.base.write_op_ch, op, now, hk)
.await
.expect("Failed to insert");
Expand Down

0 comments on commit 54ab77b

Please sign in to comment.