fix: access to wrong thread local after command migrates fiber to a different thread (#2410)

* fix: access to wrong thread local after command migrates fiber to a different
thread
This commit is contained in:
Kostas Kyrimis 2024-01-17 08:19:10 +02:00 committed by GitHub
parent 1fb3c74933
commit c8871896d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 34 deletions

View file

@ -181,4 +181,13 @@ void ServerState::ReturnInterpreter(Interpreter* ir) {
interpreter_mgr_.Return(ir);
}
ServerState* ServerState::SafeTLocal() {
// https://stackoverflow.com/a/75622732
asm volatile("");
return state_;
}
bool ServerState::ShouldLogSlowCmd(unsigned latency_usec) const {
return slow_log_shard_.IsEnabled() && latency_usec >= log_slower_than_usec;
}
} // end of namespace dfly