[webkit-dev] WTF::callOnMainThread() and re-entrancy

Drew Wilson atwilson at google.com
Tue Mar 9 12:55:08 PST 2010


Yeah, that seems to be the least invasive.

And we're already confident that creating a zero-delay timer won't cause
event source starvation, since that's how postTask() used to work.

-atw

On Tue, Mar 9, 2010 at 12:53 PM, Dmitry Titov <dimich at chromium.org> wrote:

> I've tried to post a timer if the scheduleDispatchFunctionsFromMainThread
> comes on main thread - this fixes the test and it is a minimal change.
>
> Drew, let me know if you want to dig deeper in CFRunLoopObserver, otherwise
> I could whip up a patch (post a timer from main thread + postTask change
> from Dumi's patch).
>
> Dmitry
>
> On Tue, Mar 9, 2010 at 12:37 PM, Drew Wilson <atwilson at google.com> wrote:
>
>> That's a great idea:
>>
>>
>> http://developer.apple.com/Mac/library/documentation/CoreFoundation/Reference/CFRunLoopObserverRef/Reference/reference.html#//apple_ref/c/tdef/CFRunLoopActivity
>>
>>
>> <http://developer.apple.com/Mac/library/documentation/CoreFoundation/Reference/CFRunLoopObserverRef/Reference/reference.html#//apple_ref/c/tdef/CFRunLoopActivity>This
>> gives us lots of places to hook. scheduleDispatchFunctionsFromMainThread()
>> could be a no-op on the mac, if we just always invoke
>> dispatchFunctionsFromMainThread() at a specified point in the loop (e.g.
>> kCFRunLoopBeforeWaiting<http://reference.html#//apple_ref/doc/c_ref/kCFRunLoopBeforeWaiting>
>> ).
>>
>> The only downside is that I'm not sure how to implement the "yield for UI
>> events" behavior in dispatchFunctionsFromMainThread() if we're calling this
>> from an observer - we actually need to have some kind of event generated to
>> make sure we wake up. Maybe we could use
>> scheduleDispatchFunctionsFromMainThread() to fire an event to make sure we
>> have something to process, but actually do the processing from within the
>> observer.
>>
>> -atw
>>
>> On Tue, Mar 9, 2010 at 11:55 AM, Alexey Proskuryakov <ap at webkit.org>wrote:
>>
>>>
>>> On 09.03.2010, at 11:51, Drew Wilson wrote:
>>>
>>>  That actually is an interesting idea - perhaps we could implement
>>>> scheduleDispatchFunctionsFromMainThread() using a 0-delay timer in the case
>>>> where it's called from the main thread...
>>>>
>>>
>>> As an unsubstantiated idea, we could also consider using a run loop
>>> observer. These can be set to fire at well defined points of run loop
>>> execution.
>>>
>>> - WBR, Alexey Proskuryakov
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100309/ae1a4f1a/attachment.html>


More information about the webkit-dev mailing list