mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
chore: change thread_local to __thread when possible.
This should reduce the access cost to thread_local objects. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
149b1fa913
commit
bac9180602
7 changed files with 26 additions and 17 deletions
|
@ -18,7 +18,7 @@ ABSL_FLAG(uint32_t, interpreter_per_thread, 10, "Lua interpreters per thread");
|
|||
|
||||
namespace dfly {
|
||||
|
||||
thread_local ServerState ServerState::state_;
|
||||
__thread ServerState* ServerState::state_ = nullptr;
|
||||
|
||||
void MonitorsRepo::Add(facade::Connection* connection) {
|
||||
VLOG(1) << "register connection "
|
||||
|
@ -60,12 +60,14 @@ ServerState::~ServerState() {
|
|||
}
|
||||
|
||||
void ServerState::Init(uint32_t thread_index) {
|
||||
gstate_ = GlobalState::ACTIVE;
|
||||
thread_index_ = thread_index;
|
||||
state_ = new ServerState();
|
||||
state_->gstate_ = GlobalState::ACTIVE;
|
||||
state_->thread_index_ = thread_index;
|
||||
}
|
||||
|
||||
void ServerState::Shutdown() {
|
||||
gstate_ = GlobalState::SHUTTING_DOWN;
|
||||
void ServerState::Destroy() {
|
||||
delete state_;
|
||||
state_ = nullptr;
|
||||
}
|
||||
|
||||
Interpreter* ServerState::BorrowInterpreter() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue