mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 23:28:56 +08:00
shared_ptr (#5830)
This commit is contained in:
@@ -51,8 +51,8 @@ CoreWorker::CoreWorker(
|
||||
RAY_CHECK_OK(gcs_client_->Connect(io_service_));
|
||||
|
||||
// Initialize profiler.
|
||||
profiler_ = std::unique_ptr<worker::Profiler>(
|
||||
new worker::Profiler(worker_context_, node_ip_address, io_service_, gcs_client_));
|
||||
profiler_ = std::make_shared<worker::Profiler>(worker_context_, node_ip_address,
|
||||
io_service_, gcs_client_);
|
||||
|
||||
object_interface_ =
|
||||
std::unique_ptr<CoreWorkerObjectInterface>(new CoreWorkerObjectInterface(
|
||||
|
||||
@@ -101,7 +101,7 @@ class CoreWorker {
|
||||
boost::asio::io_service::work io_work_;
|
||||
|
||||
std::thread io_thread_;
|
||||
std::unique_ptr<worker::Profiler> profiler_;
|
||||
std::shared_ptr<worker::Profiler> profiler_;
|
||||
std::unique_ptr<RayletClient> raylet_client_;
|
||||
std::unique_ptr<gcs::RedisGcsClient> gcs_client_;
|
||||
std::unique_ptr<CoreWorkerTaskInterface> task_interface_;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace ray {
|
||||
|
||||
namespace worker {
|
||||
|
||||
ProfileEvent::ProfileEvent(const std::unique_ptr<Profiler> &profiler,
|
||||
ProfileEvent::ProfileEvent(const std::shared_ptr<Profiler> profiler,
|
||||
const std::string &event_type)
|
||||
: profiler_(profiler) {
|
||||
rpc_event_.set_event_type(event_type);
|
||||
|
||||
@@ -37,7 +37,7 @@ class Profiler {
|
||||
|
||||
class ProfileEvent {
|
||||
public:
|
||||
ProfileEvent(const std::unique_ptr<Profiler> &profiler, const std::string &event_type);
|
||||
ProfileEvent(const std::shared_ptr<Profiler> profiler, const std::string &event_type);
|
||||
|
||||
~ProfileEvent() {
|
||||
rpc_event_.set_end_time(current_sys_time_seconds());
|
||||
@@ -49,7 +49,7 @@ class ProfileEvent {
|
||||
}
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Profiler> &profiler_;
|
||||
const std::shared_ptr<Profiler> profiler_;
|
||||
rpc::ProfileTableData::ProfileEvent rpc_event_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user