TsList: make lock non-static again

GitOrigin-RevId: 7df7dee8bf609f928b351b448c9e132fb2118942
This commit is contained in:
Arseny Smirnov 2020-07-31 16:07:07 +03:00
parent 19507a7f7a
commit bbea867145
2 changed files with 5 additions and 5 deletions

View File

@ -3737,8 +3737,6 @@ void Td::start_up() {
LOG_IF(FATAL, symbol != c) << "TDLib requires little-endian platform";
}
TsList<NetQueryDebug>::lock().unlock(); // initialize mutex before any NetQuery
VLOG(td_init) << "Create Global";
set_context(std::make_shared<Global>());
G()->set_net_query_stats(td_options_.net_query_stats);

View File

@ -180,9 +180,8 @@ class TsList : public TsListNode<DataT> {
}
this->parent = nullptr;
}
static std::unique_lock<std::mutex> lock() TD_WARN_UNUSED_RESULT {
static std::mutex mutex;
return std::unique_lock<std::mutex>(mutex);
std::unique_lock<std::mutex> lock() TD_WARN_UNUSED_RESULT {
return std::unique_lock<std::mutex>(mutex_);
}
TsListNode<DataT> *begin() {
return this->get_next();
@ -198,6 +197,9 @@ class TsList : public TsListNode<DataT> {
}
return res;
}
private:
std::mutex mutex_;
};
template <class DataT>