void Client::initThread(const char* desc, ServiceContext* service, transport::SessionHandle session) { invariant(currentClient.getMake()->get() == nullptr); std::string fullDesc; if (session) { fullDesc = str::stream() << desc << session->id(); } else { fullDesc = desc; } setThreadName(fullDesc.c_str()); // Create the client obj, attach to thread *currentClient.get() = service->makeClient(fullDesc, std::move(session)); }
void Client::destroy() { invariant(currentClient.get()); invariant(currentClient.get()->get()); currentClient.reset(nullptr); }