Ignore:
Timestamp:
Feb 13, 2009, 1:29:21 AM (16 years ago)
Author:
[email protected]
Message:

2009-02-13 David Levin <[email protected]>

Reviewed by Darin Adler.

Bug 23926: Race condition in callOnMainThreadAndWait
<https://bugs.webkit.org/show_bug.cgi?id=23926>

  • wtf/MainThread.cpp: Removed callOnMainThreadAndWait since it isn't used.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/MainThread.cpp

    r40888 r40969  
    4040    MainThreadFunction* function;
    4141    void* context;
    42     ThreadCondition* syncFlag;
    4342
    44     FunctionWithContext(MainThreadFunction* function = 0, void* context = 0, ThreadCondition* syncFlag = 0)
     43    FunctionWithContext(MainThreadFunction* function = 0, void* context = 0)
    4544        : function(function)
    4645        , context(context)
    47         , syncFlag(syncFlag)
    4846    {
    4947    }
     
    9593
    9694        invocation.function(invocation.context);
    97         if (invocation.syncFlag)
    98             invocation.syncFlag->signal();
    99        
     95
    10096        // If we are running accumulated functions for too long so UI may become unresponsive, we need to
    10197        // yield so the user input can be processed. Otherwise user may not be able to even close the window.
     
    122118}
    123119
    124 void callOnMainThreadAndWait(MainThreadFunction* function, void* context)
    125 {
    126     ASSERT(function);
    127 
    128     if (isMainThread()) {
    129         function(context);
    130         return;
    131     }
    132 
    133     ThreadCondition syncFlag;
    134     Mutex conditionMutex;
    135     bool needToSchedule = false;
    136     {
    137         MutexLocker locker(mainThreadFunctionQueueMutex());
    138         needToSchedule = functionQueue().size() == 0;
    139         functionQueue().append(FunctionWithContext(function, context, &syncFlag));
    140         conditionMutex.lock();
    141     }
    142 
    143     if (needToSchedule)
    144         scheduleDispatchFunctionsOnMainThread();
    145     syncFlag.wait(conditionMutex);
    146 }
    147 
    148120void setMainThreadCallbacksPaused(bool paused)
    149121{
Note: See TracChangeset for help on using the changeset viewer.