Exemplo n.º 1
0
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));
}
Exemplo n.º 2
0
void Client::initThreadIfNotAlready(const char* desc) {
    if (currentClient.getMake()->get())
        return;
    initThread(desc);
}
Exemplo n.º 3
0
Client& cc() {
    Client* c = currentClient.getMake()->get();
    invariant(c);
    return *c;
}
Exemplo n.º 4
0
bool haveClient() {
    return currentClient.getMake()->get();
}
Exemplo n.º 5
0
Client* Client::getCurrent() {
    return currentClient.getMake()->get();
}