-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: refactor pstd_mutex #1440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: refactor pstd_mutex #1440
Conversation
@@ -12,7 +12,7 @@ | |||
|
|||
class PikaAuxiliaryThread : public net::Thread { | |||
public: | |||
PikaAuxiliaryThread() : mu_(), cv_(&mu_) { set_thread_name("AuxiliaryThread"); } | |||
PikaAuxiliaryThread() { set_thread_name("AuxiliaryThread"); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这行为啥要改动啊?没看明白
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pstd::Mutex 和 pstd::ConVar都改了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using Mutex = std::mutex;
using CondVar = std::condition_variable;
用标准库的默认构造就行
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不太清楚这里为啥没换成标准库实现。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不太清楚这里为啥没换成标准库实现。
哪里没换
6244afb
to
b465c2f
Compare
ab9bf3c
to
965fde2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
@@ -12,7 +12,7 @@ | |||
|
|||
class PikaAuxiliaryThread : public net::Thread { | |||
public: | |||
PikaAuxiliaryThread() : mu_(), cv_(&mu_) { set_thread_name("AuxiliaryThread"); } | |||
PikaAuxiliaryThread() { set_thread_name("AuxiliaryThread"); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pstd::Mutex 和 pstd::ConVar都改了
@@ -12,7 +12,7 @@ | |||
|
|||
class PikaAuxiliaryThread : public net::Thread { | |||
public: | |||
PikaAuxiliaryThread() : mu_(), cv_(&mu_) { set_thread_name("AuxiliaryThread"); } | |||
PikaAuxiliaryThread() { set_thread_name("AuxiliaryThread"); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using Mutex = std::mutex;
using CondVar = std::condition_variable;
用标准库的默认构造就行
@@ -12,7 +12,7 @@ | |||
|
|||
class PikaAuxiliaryThread : public net::Thread { | |||
public: | |||
PikaAuxiliaryThread() : mu_(), cv_(&mu_) { set_thread_name("AuxiliaryThread"); } | |||
PikaAuxiliaryThread() { set_thread_name("AuxiliaryThread"); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不太清楚这里为啥没换成标准库实现。
哪里没换
version_->term_ = term; | ||
version_->StableSave(); | ||
} | ||
|
||
uint32_t term() { | ||
pstd::RWLock(&(version_->rwlock_), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里原本应该是false的
last_meta_sync_timestamp_ = time(nullptr); | ||
} | ||
|
||
bool PikaServer::IsFirstMetaSync() { | ||
pstd::RWLock sp_l(&state_protector_, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里原本应该是false
965fde2
to
b8f8396
Compare
…e and std::shared_mutex
b8f8396
to
e3286c3
Compare
* Remove pstd::cond_lock * refactor: Refactor pstd_mutex with std::mutex, std::condition_variable and std::shared_mutex
* Remove pstd::cond_lock * refactor: Refactor pstd_mutex with std::mutex, std::condition_variable and std::shared_mutex
* Remove pstd::cond_lock * refactor: Refactor pstd_mutex with std::mutex, std::condition_variable and std::shared_mutex
No description provided.