Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: kaihsun <[email protected]>
  • Loading branch information
kevin85421 committed Dec 25, 2024
1 parent cef54a9 commit 1ea2688
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/mock/ray/core_worker/memory_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@ class DefaultCoreWorkerMemoryStoreWithThread : public CoreWorkerMemoryStore {
std::unique_ptr<InstrumentedIOContextWithThread> io_context =
std::make_unique<InstrumentedIOContextWithThread>(
"DefaultCoreWorkerMemoryStoreWithThread");
return std::make_unique<DefaultCoreWorkerMemoryStoreWithThread>(
std::move(io_context));
// C++ limitation: std::make_unique cannot be used because std::unique_ptr cannot
// invoke private constructors.
return std::unique_ptr<DefaultCoreWorkerMemoryStoreWithThread>(
new DefaultCoreWorkerMemoryStoreWithThread(std::move(io_context)));
}

static std::shared_ptr<DefaultCoreWorkerMemoryStoreWithThread> CreateShared() {
std::unique_ptr<InstrumentedIOContextWithThread> io_context =
std::make_unique<InstrumentedIOContextWithThread>(
"DefaultCoreWorkerMemoryStoreWithThread");
return std::make_shared<DefaultCoreWorkerMemoryStoreWithThread>(
std::move(io_context));
// C++ limitation: std::make_shared cannot be used because std::shared_ptr cannot
// invoke private constructors.
return std::shared_ptr<DefaultCoreWorkerMemoryStoreWithThread>(
new DefaultCoreWorkerMemoryStoreWithThread(std::move(io_context)));
}

~DefaultCoreWorkerMemoryStoreWithThread() { io_context_->Stop(); }
Expand Down

0 comments on commit 1ea2688

Please sign in to comment.