diff --git a/apps/cpp_rpc/rpc_server.cc b/apps/cpp_rpc/rpc_server.cc index 52b5da965b4c..bab01463de2a 100644 --- a/apps/cpp_rpc/rpc_server.cc +++ b/apps/cpp_rpc/rpc_server.cc @@ -22,7 +22,8 @@ * \brief RPC Server implementation. */ #include -#if defined(__linux__) || defined(__ANDROID__) +#if defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) +#include #include #include #endif @@ -52,7 +53,7 @@ namespace runtime { * \brief wait the child process end. * \param status status value */ -#if defined(__linux__) || defined(__ANDROID__) +#if defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) static pid_t waitPidEintr(int* status) { pid_t pid = 0; while ((pid = waitpid(-1, status, 0)) == -1) { @@ -162,7 +163,7 @@ class RPCServer { } int timeout = GetTimeOutFromOpts(opts); -#if defined(__linux__) || defined(__ANDROID__) +#if defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) // step 3: serving if (timeout != 0) { const pid_t timer_pid = fork(); @@ -219,6 +220,10 @@ class RPCServer { auto dur = high_resolution_clock::now() - start_time; LOG(INFO) << "Serve Time " << duration_cast(dur).count() << "ms"; +#else + LOG(WARNING) << "Unknown platform. It is not known how to bring up the subprocess." + << " RPC will be launched in the main thread."; + ServerLoopProc(conn, addr, work_dir_); #endif // close from our side. LOG(INFO) << "Socket Connection Closed";