Skip to content

Commit

Permalink
p1: use owned promise for disk scheduler (#610)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi <[email protected]>
  • Loading branch information
skyzh committed Sep 11, 2023
1 parent 558030f commit 7c6bd1b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/include/storage/disk/disk_scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct DiskRequest {
page_id_t page_id_;

/** Callback used to signal to the request issuer when the request has been completed. */
std::promise<bool> &callback_;
std::promise<bool> callback_;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions test/storage/disk_scheduler_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ TEST(DiskSchedulerTest, DISABLED_ScheduleWriteReadPageTest) {
auto promise2 = disk_scheduler->CreatePromise();
auto future2 = promise2.get_future();

disk_scheduler->Schedule({/*is_write=*/true, reinterpret_cast<char *>(&data), /*page_id=*/0, promise1});
disk_scheduler->Schedule({/*is_write=*/false, reinterpret_cast<char *>(&buf), /*page_id=*/0, promise2});
disk_scheduler->Schedule({/*is_write=*/true, reinterpret_cast<char *>(&data), /*page_id=*/0, std::move(promise1)});
disk_scheduler->Schedule({/*is_write=*/false, reinterpret_cast<char *>(&buf), /*page_id=*/0, std::move(promise2)});

ASSERT_TRUE(future1.get());
ASSERT_TRUE(future2.get());
Expand Down

0 comments on commit 7c6bd1b

Please sign in to comment.