Skip to content
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

Merged
merged 2 commits into from
May 10, 2023

Conversation

4kangjc
Copy link
Contributor

@4kangjc 4kangjc commented May 6, 2023

No description provided.

@@ -12,7 +12,7 @@

class PikaAuxiliaryThread : public net::Thread {
public:
PikaAuxiliaryThread() : mu_(), cv_(&mu_) { set_thread_name("AuxiliaryThread"); }
PikaAuxiliaryThread() { set_thread_name("AuxiliaryThread"); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这行为啥要改动啊?没看明白

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pstd::Mutex 和 pstd::ConVar都改了

Copy link
Contributor Author

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;

用标准库的默认构造就行

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不太清楚这里为啥没换成标准库实现。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不太清楚这里为啥没换成标准库实现。

哪里没换

@AlexStocks AlexStocks requested a review from chejinge May 6, 2023 11:58
include/pika_conf.h Outdated Show resolved Hide resolved
@4kangjc 4kangjc force-pushed the pstd-support-windows branch 4 times, most recently from ab9bf3c to 965fde2 Compare May 8, 2023 03:07
Copy link
Contributor Author

@4kangjc 4kangjc left a 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"); }
Copy link
Contributor Author

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"); }
Copy link
Contributor Author

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;

用标准库的默认构造就行

src/pika_stable_log.cc Show resolved Hide resolved
src/net/src/bg_thread.cc Show resolved Hide resolved
src/net/src/bg_thread.cc Show resolved Hide resolved
src/pika_statistic.cc Show resolved Hide resolved
include/pika_conf.h Outdated Show resolved Hide resolved
@@ -12,7 +12,7 @@

class PikaAuxiliaryThread : public net::Thread {
public:
PikaAuxiliaryThread() : mu_(), cv_(&mu_) { set_thread_name("AuxiliaryThread"); }
PikaAuxiliaryThread() { set_thread_name("AuxiliaryThread"); }
Copy link
Contributor Author

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);
Copy link
Contributor Author

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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里原本应该是false

@AlexStocks AlexStocks requested a review from Tangruilin May 8, 2023 13:19
@4kangjc 4kangjc changed the title Pstd support windows refactor: Refactor pstd_mutex May 10, 2023
@AlexStocks AlexStocks changed the title refactor: Refactor pstd_mutex refactor pstd_mutex May 10, 2023
@AlexStocks AlexStocks merged commit 4886049 into OpenAtomFoundation:unstable May 10, 2023
ForestLH pushed a commit to ForestLH/pika that referenced this pull request May 10, 2023
* Remove pstd::cond_lock

* refactor: Refactor pstd_mutex with std::mutex, std::condition_variable and std::shared_mutex
@yaoyinnan yaoyinnan changed the title refactor pstd_mutex fix: refactor pstd_mutex Jul 25, 2023
bigdaronlee163 pushed a commit to bigdaronlee163/pika that referenced this pull request Jun 8, 2024
* Remove pstd::cond_lock

* refactor: Refactor pstd_mutex with std::mutex, std::condition_variable and std::shared_mutex
cheniujh pushed a commit to cheniujh/pika that referenced this pull request Sep 24, 2024
* Remove pstd::cond_lock

* refactor: Refactor pstd_mutex with std::mutex, std::condition_variable and std::shared_mutex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants