Differentiate waitForReply from waitForSyncreply
Created attachment 69097 [details] Patch
Committed r68559: <http://trac.webkit.org/changeset/68559>
Comment on attachment 69097 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=69097&action=review > WebKit2/Platform/CoreIPC/Connection.cpp:208 > + while (!timedOut) { > + MutexLocker locker(m_waitForSyncReplyMutex); > + > + // First, check if there is a sync reply at the top of the stack. > + ASSERT(!m_pendingSyncReplies.isEmpty()); > + > + PendingSyncReply& pendingSyncReply = m_pendingSyncReplies.last(); > + ASSERT(pendingSyncReply.syncRequestID == syncRequestID); > + > + // We found the sync reply, return it. > + if (pendingSyncReply.didReceiveReply) > + return pendingSyncReply.releaseReplyDecoder(); > + > + // We didn't find a sync reply yet, keep waiting. > + timedOut = !m_waitForSyncReplyCondition.timedWait(m_waitForSyncReplyMutex, absoluteTime); > + } This code is a little strange with respect to the mutex and condition variable. When you enter timedWait, m_waitForSyncReplyMutex is unlocked. When you exit timedWait, m_waitForSyncReplyMutex is locked again. But then you unlock/lock it right away when you start the loop over. I think a better pattern would be to move the locker local variable outside of the while loop. That way you'll lock the mutex before entering the loop, unlock it each time you wait, relock it each time you finish waiting, and unlock it when the function exits.