Skip to content
Permalink
Browse files
Make WorkQueue aware of potential errors with ::WaitForMultipleObjects
Fixes <http://webkit.org/b/42846> WorkQueue should detect
::WaitForMultipleObject failures

Reviewed by Anders Carlsson.

* Platform/win/WorkQueueWin.cpp:
(WorkQueue::workQueueThreadBody): Added some assertions about the
various things that can fail with ::WaitForMultipleObjects,
specifically:
  - Passing too many objects
  - Timeouts (which shouldn't happen since we pass a timeout interval
    of INFINITE)
  - Abandoned mutexes (which shouldn't happen since we don't wait on
    any mutexes currently)
  - Miscellaneous failures

Canonical link: https://commits.webkit.org/54749@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aroben committed Jul 22, 2010
1 parent 3370089 commit 9c7d7abcf19a1ee4ce9f610c564742c90d681953
Showing with 31 additions and 0 deletions.
  1. +20 −0 WebKit2/ChangeLog
  2. +11 −0 WebKit2/Platform/win/WorkQueueWin.cpp
@@ -1,3 +1,23 @@
2010-07-22 Adam Roben <aroben@apple.com>

Make WorkQueue aware of potential errors with ::WaitForMultipleObjects

Fixes <http://webkit.org/b/42846> WorkQueue should detect
::WaitForMultipleObject failures

Reviewed by Anders Carlsson.

* Platform/win/WorkQueueWin.cpp:
(WorkQueue::workQueueThreadBody): Added some assertions about the
various things that can fail with ::WaitForMultipleObjects,
specifically:
- Passing too many objects
- Timeouts (which shouldn't happen since we pass a timeout interval
of INFINITE)
- Abandoned mutexes (which shouldn't happen since we don't wait on
any mutexes currently)
- Miscellaneous failures

2010-07-22 Sam Weinig <sam@webkit.org>

Reviewed by Anders Carlsson.
@@ -59,8 +59,19 @@ void WorkQueue::workQueueThreadBody()
// Add the "perform work" event handle.
handles.append(m_performWorkEvent);

ASSERT(handles.size() <= MAXIMUM_WAIT_OBJECTS);

// Now we wait.
DWORD result = ::WaitForMultipleObjects(handles.size(), handles.data(), FALSE, INFINITE);
if (result == WAIT_FAILED) {
DWORD error = ::GetLastError();
ASSERT_NOT_REACHED();
}

// The wait should never time out since we passed INFINITE for the timeout interval.
ASSERT(result != WAIT_TIMEOUT);
// We don't know how (or need) to handle abandoned mutexes yet.
ASSERT(result < WAIT_ABANDONED_0 || result >= WAIT_ABANDONED_0 + handles.size());

if (result == handles.size() - 1)
performWork();

0 comments on commit 9c7d7ab

Please sign in to comment.