[libcxx-commits] [libcxx] [libc++] std::condition_variable_any overloads accepting std::stop_token don't register for stop callbacks (PR #77099)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 8 10:54:22 PST 2024
================
@@ -257,23 +258,38 @@ condition_variable_any::wait_for(_Lock& __lock, const chrono::duration<_Rep, _Pe
template <class _Lock, class _Predicate>
bool condition_variable_any::wait(_Lock& __lock, stop_token __stoken, _Predicate __pred) {
- while (!__stoken.stop_requested()) {
+ shared_ptr<mutex> __mut = __mut_;
----------------
sn-rbroker wrote:
The only reason I did this was to stay consistent with the other condition_variable_any::wait calls that don't accept a stop_token, because they are currently copying the internal mutex pointer. If you don't think it's desirable/useful I can update the PR to remove it.
Although I'm not sure if you'd rather update #77127 to include the internal lock lifetime changes instead, and drop this PR?
https://github.com/llvm/llvm-project/pull/77099
More information about the libcxx-commits
mailing list