diff --git a/cpp/example/example.cc b/cpp/example/example.cc index 716f4f5bf..868687020 100644 --- a/cpp/example/example.cc +++ b/cpp/example/example.cc @@ -28,9 +28,8 @@ class Counter { RAY_REMOTE(Counter::FactoryCreate, &Counter::Add); int main(int argc, char **argv) { - /// configuration and initialization - ray::RayConfig config; - ray::Init(config); + /// initialization + ray::Init(); /// put and get object auto object = ray::Put(100); diff --git a/cpp/src/ray/api.cc b/cpp/src/ray/api.cc index 645fc55db..31ddf6bc2 100644 --- a/cpp/src/ray/api.cc +++ b/cpp/src/ray/api.cc @@ -19,20 +19,21 @@ namespace ray { -void Init(ray::RayConfig &config, int *argc, char ***argv) { +void Init(RayConfig &config, int *argc, char ***argv) { ray::internal::ConfigInternal::Instance().Init(config, argc, argv); - Init(); -} - -void Init(ray::RayConfig &config) { Init(config, nullptr, nullptr); } - -void Init() { std::call_once(is_inited_, [] { auto runtime = ray::internal::AbstractRayRuntime::DoInit(); ray::internal::RayRuntimeHolder::Instance().Init(runtime); }); } +void Init(RayConfig &config) { Init(config, nullptr, nullptr); } + +void Init() { + RayConfig config; + Init(config, nullptr, nullptr); +} + void Shutdown() { ray::internal::AbstractRayRuntime::DoShutdown(); } -} // namespace ray \ No newline at end of file +} // namespace ray