Move ClientManager singleton creation to ClientManager::get_manager_singleton.
GitOrigin-RevId: 071b947ff072186c70387cbd00f1c6b1c17d0e6b
This commit is contained in:
parent
09f906f192
commit
714f037f15
@ -631,4 +631,10 @@ ClientManager::~ClientManager() = default;
|
|||||||
ClientManager::ClientManager(ClientManager &&other) = default;
|
ClientManager::ClientManager(ClientManager &&other) = default;
|
||||||
ClientManager &ClientManager::operator=(ClientManager &&other) = default;
|
ClientManager &ClientManager::operator=(ClientManager &&other) = default;
|
||||||
|
|
||||||
|
ClientManager *ClientManager::get_manager_singleton() {
|
||||||
|
static ClientManager client_manager;
|
||||||
|
static ExitGuard exit_guard;
|
||||||
|
return &client_manager;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -247,6 +247,12 @@ class ClientManager final {
|
|||||||
*/
|
*/
|
||||||
ClientManager &operator=(ClientManager &&other);
|
ClientManager &operator=(ClientManager &&other);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a pointer to a singleton ClientManager instance.
|
||||||
|
* \return A unique singleton ClientManager instance.
|
||||||
|
*/
|
||||||
|
static ClientManager *get_manager_singleton();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Client;
|
friend class Client;
|
||||||
class Impl;
|
class Impl;
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "td/telegram/td_api_json.h"
|
#include "td/telegram/td_api_json.h"
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/ExitGuard.h"
|
|
||||||
#include "td/utils/JsonBuilder.h"
|
#include "td/utils/JsonBuilder.h"
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
#include "td/utils/port/thread_local.h"
|
#include "td/utils/port/thread_local.h"
|
||||||
@ -116,9 +115,7 @@ const char *ClientJson::execute(Slice request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ClientManager *get_manager() {
|
static ClientManager *get_manager() {
|
||||||
static ClientManager client_manager;
|
return ClientManager::get_manager_singleton();
|
||||||
static ExitGuard exit_guard;
|
|
||||||
return &client_manager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::mutex extra_mutex;
|
static std::mutex extra_mutex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user