Add destroying pthread locks and cond. (#1761)

* Add destroying pthread locks and cond.

* Add memory check on FreeBSD.
This commit is contained in:
xiehan
2025-07-23 18:26:02 +08:00
committed by GitHub
parent fd3c01452f
commit 7a3838754e
7 changed files with 19 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ libgtest-dev make libssl-dev
sudo apt-get install -y redis valgrind
sudo apt-get install -y valgrind
sudo apt-get install -y libsnappy-dev libzstd-dev liblz4-dev
- uses: actions/checkout@v2
- name: make
@@ -40,7 +40,7 @@ jobs:
run: |
sudo dnf -y update
sudo dnf install -y cmake gcc-c++ gtest-devel make
sudo dnf install -y openssl-devel redis valgrind
sudo dnf install -y openssl-devel valgrind
sudo dnf install -y snappy-devel libzstd-devel lz4-devel zlib-devel
- name: make
run: make KAFKA=y
@@ -63,6 +63,7 @@ jobs:
prepare: |
pkg update -f
pkg install -y cmake gmake gcc pkgconf openssl devel/googletest
pkg install -y valgrind
pkg install -y snappy zstd liblz4
run: |
freebsd-version

View File

@@ -112,6 +112,8 @@ static void __thrdpool_terminate(int in_pool, thrdpool_t *pool)
pthread_mutex_unlock(&pool->mutex);
if (!pthread_equal(pool->tid, __zero_tid))
pthread_join(pool->tid, NULL);
pthread_cond_destroy(&term);
}
static int __thrdpool_create_threads(size_t nthreads, thrdpool_t *pool)

View File

@@ -49,6 +49,8 @@ private:
{
for (UPSGroupPolicy *policy : this->upstream_policies)
delete policy;
pthread_mutex_destroy(&mutex);
}
pthread_mutex_t mutex;

View File

@@ -461,6 +461,8 @@ private:
kv.second->deinit();
delete kv.second;
}
pthread_rwlock_destroy(&rwlock_);
}
private:

View File

@@ -38,6 +38,11 @@ public:
this->weight = 0;
}
~EndpointGroup()
{
pthread_mutex_destroy(&this->mutex);
}
EndpointAddress *get_one(WFNSTracing *tracing);
EndpointAddress *get_one_backup(WFNSTracing *tracing);

View File

@@ -141,5 +141,7 @@ WFNameService::~WFNameService()
rb_erase(&entry->rb, &this->root);
free(entry);
}
pthread_rwlock_destroy(&this->rwlock);
}

View File

@@ -52,6 +52,9 @@ WFServiceGovernance::~WFServiceGovernance()
{
for (EndpointAddress *addr : this->servers)
delete addr;
pthread_rwlock_destroy(&this->rwlock);
pthread_mutex_destroy(&this->breaker_lock);
}
PolicyAddrParams::PolicyAddrParams()