Fix PR23293 - Do not unlock shared state before notifying consumers.
Within the shared state methods do not unlock the lock guards manually. This could cause a race condition where the shared state is destroyed before the method is complete. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239577 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -651,7 +651,6 @@ __assoc_state<_Rp>::set_value(_Arg& __arg)
|
||||
#endif
|
||||
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed | base::ready;
|
||||
__lk.unlock();
|
||||
__cv_.notify_all();
|
||||
}
|
||||
|
||||
@@ -672,7 +671,6 @@ __assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
|
||||
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
}
|
||||
|
||||
template <class _Rp>
|
||||
@@ -733,7 +731,6 @@ __assoc_state<_Rp&>::set_value(_Rp& __arg)
|
||||
#endif
|
||||
__value_ = _VSTD::addressof(__arg);
|
||||
this->__state_ |= base::__constructed | base::ready;
|
||||
__lk.unlock();
|
||||
__cv_.notify_all();
|
||||
}
|
||||
|
||||
@@ -749,7 +746,6 @@ __assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
|
||||
__value_ = _VSTD::addressof(__arg);
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
__lk.unlock();
|
||||
}
|
||||
|
||||
template <class _Rp>
|
||||
|
Reference in New Issue
Block a user