LibCore: Fix ThreadedPromise issues found with ThreadSanitizer

This commit is contained in:
Rocco Corsi 2025-09-02 12:44:27 -04:00 committed by Gregory Bertilson
parent ec73299398
commit 892e75ddfb
2 changed files with 2 additions and 3 deletions

View file

@ -61,7 +61,6 @@ public:
bool has_completed()
{
Threading::MutexLocker locker { m_mutex };
return m_has_completed;
}
@ -183,7 +182,7 @@ private:
Function<ErrorOr<void>(ResultType&&)> m_resolution_handler;
Function<void(ErrorType&&)> m_rejection_handler;
Threading::Mutex m_mutex;
bool m_has_completed;
Atomic<bool> m_has_completed;
};
}

View file

@ -158,7 +158,7 @@ TEST_CASE(threaded_promise_resolved_later)
{
Core::EventLoop loop;
IGNORE_USE_IN_ESCAPING_LAMBDA bool unblock_thread = false;
IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<bool> unblock_thread = false;
bool resolved = false;
bool rejected = true;
Optional<pthread_t> thread_id;