Made condition variable data volatile. This will hopefully fix

an strange deadlock seen on OSX.  The CSocketMultiplexer deadlocks
with two threads, one waiting for m_polling to become false and
the other waiting for m_pollable to become true.  The weird part
is that they're both false so the first thread should proceed.
It either didn't receive the broadcast when m_polling went to
false or it's not really checking the actual value of that flag.
I can't see how the former is possible and this change fixes the
latter.
This commit is contained in:
crs 2004-11-10 21:00:30 +00:00
parent d8b6fab8bb
commit 6ea96719ab

View File

@ -160,12 +160,12 @@ public:
Get the variable's value. The condition variable should be locked
before calling this method.
*/
operator const T&() const;
operator const volatile T&() const;
//@}
private:
T m_data;
volatile T m_data;
};
template <class T>
@ -199,8 +199,7 @@ CCondVar<T>::~CCondVar()
template <class T>
inline
CCondVar<T>&
CCondVar<T>::operator=(
const CCondVar<T>& cv)
CCondVar<T>::operator=(const CCondVar<T>& cv)
{
m_data = cv.m_data;
return *this;
@ -209,8 +208,7 @@ CCondVar<T>::operator=(
template <class T>
inline
CCondVar<T>&
CCondVar<T>::operator=(
const T& data)
CCondVar<T>::operator=(const T& data)
{
m_data = data;
return *this;
@ -218,7 +216,7 @@ CCondVar<T>::operator=(
template <class T>
inline
CCondVar<T>::operator const T&() const
CCondVar<T>::operator const volatile T&() const
{
return m_data;
}