fixed thread pool memory_order bug

This commit is contained in:
Lasan Mahaliyana
2026-02-06 23:29:13 +05:30
parent 3fd04004d6
commit b46fabb8a7
@@ -32,7 +32,7 @@ ThreadPool::ThreadPool(size_t max_pool_size)
ThreadPool::~ThreadPool() { ShutDown(); }
bool ThreadPool::Start() {
shut_down_.store(false, std::memory_order_acquire);
shut_down_.store(false, std::memory_order_release);
auto runner = [this]() {
while (true) {
@@ -87,7 +87,7 @@ bool ThreadPool::Run(Runnable &&task) {
void ThreadPool::ShutDown() {
{
absl::MutexLock l(&tasks_mutex_);
shut_down_.store(true, std::memory_order_acquire);
shut_down_.store(true, std::memory_order_relaxed);
}
{
absl::ReaderMutexLock l(&threads_mutex_);