Skip to content
  • mrowe@apple.com's avatar
    <rdar://problem/10177824> IconDatabase’s use of ThreadCondition leads to... · 245b8e62
    mrowe@apple.com authored
    <rdar://problem/10177824> IconDatabase’s use of ThreadCondition leads to assertion failures in the face of spurious wakeups
    
    It's possible for ThreadCondition::wait to return spuriously without the condition having been signaled.
    When that happens we should immediately return to waiting rather than doing our normal work, as some of that
    work relies on wakeSyncThread having been called to signal the condition.
    
    Reviewed by Sam Weinig.
    
    * loader/icon/IconDatabase.cpp:
    (WebCore::IconDatabase::IconDatabase):
    (WebCore::IconDatabase::wakeSyncThread): Note that we have work for the sync thread to do.
    (WebCore::IconDatabase::syncThreadMainLoop): If we were woken with no work to do, immediately
    go back to waiting on the condition variable. Otherwise, reset m_syncThreadHasWorkToDo and then
    do that work. We also switch to moving m_disabledSuddenTerminationForSyncThread immediately in to
    our local shouldReenableSuddenTermination variable since it can be updated by other threads while
    we don't hold the lock. This makes it inappropriate to make assumptions about its value after dropping
    and reacquiring the lock.
    * loader/icon/IconDatabase.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95929 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    245b8e62