Re: CMutex /CEvent (multiple threads)
See Below
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:o2mlb5h3dgmmgoavqvaeirft0jquik55qe@4ax.com...
Curiouser and Curioser:
http://support.microsoft.com/kb/141533
says that this bug was fixed in MFC 4.1
***
No, the bug that was fixed was that it returned TRUE if the return value
was WAIT_TIMEOUT.
****
It says in that article "The return value from the Lock function is also
TRUE when ::WaitForSingleObject returns WAIT_ABANDONED indicating that the
thread that owned this synchronization object (a CMutex) terminated before
releasing it."
The VC6 implementation was exactly what was stated in the article.
So clearly some bright spark put it back into mfc. Looks like the same
ping-pong that went on with the print preview window frankly.
<http://groups.google.co.uk/group/microsoft.public.vc.mfc/browse_thread/thread/1caf043bad5e7216/9769dae1e5be70a2>
Visual Studio 6 implements it this way in mtcore.cpp:
BOOL CSyncObject::Lock(DWORD dwTimeout)
{
if (::WaitForSingleObject(m_hObject, dwTimeout) == WAIT_OBJECT_0)
return TRUE;
else
return FALSE;
}
Yet vc2005 implements it the old way in mtcore.cpp:
BOOL CSyncObject::Lock(DWORD dwTimeout)
{
DWORD dwRet = ::WaitForSingleObject(m_hObject, dwTimeout);
if (dwRet == WAIT_OBJECT_0 || dwRet == WAIT_ABANDONED)
return TRUE;
else
return FALSE;
}
--
Anthony Wieser
Wieser Software Ltd