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

Drew Wilson atwilson at google.com
Tue Mar 9 12:37:23 PST 2010


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<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/e02dea37/attachment.html>


More information about the webkit-dev mailing list