W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] Race condition in media load algorithm

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 2 Aug 2010 21:20:29 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1008022113330.3056@ps20323.dreamhostps.com>
On Mon, 2 Aug 2010, Boris Zbarsky wrote:
> On 8/2/10 3:11 PM, Ian Hickson wrote:
> > > How are we defining "current asynchronous task" and "finish"?
> > 
> > In terms of the event loop algorithm:
> > 
> >     http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#processing-model-2
> 
> Ah, I see.  Is the note there about synchronous sections having no 
> side-effects something that is true by default due to the way 
> synchronous sections are used in the specification?

Yeah. It's intended to help keep the ways to implement this somewhat open.


> > > How does this setup handle cases when the "current asynchronous task"
> > > spins the event loop, if at all?
> > 
> > The spinning of the event loop is also defined in terms of the event loop
> > in a manner that strictly defines this:
> > 
> >     http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#spin-the-event-loop
> 
> I'm not sure I follow the steps here, actually.  Just to make sure I do
> understand....
> 
> Say I have a task T in the event queue.  Task T begins some algorithm that has
> a synchronous section, then spins the event loop. If I understand the steps
> in #processing-model-2 correctly, the synchronous sections would run after
> task T completes, not while task T is spinning the event loop?

The synchronous section would run as soon as the task span the event loop. 
Spinning the event loop is defined essentially as being equivalent to 
breaking the original task in two, one that does everything up to spinning 
the event loop, and one that does everything after spinning the event 
loop. You are effectively waiting for some condition to become true and 
then queueing a task to run the continuation of the algorithm. It's just 
more convenient to write the algorithms as one long set of steps rather 
than having split them up into multiple algorithms that invoke each other 
and pass state around.


> Or does "stop the currently running task" in #spin-the-event-loop imply 
> a jump to step 2 of the algorithm under #processing-model2?

Yes.


> (Note: I still have a problem with the way "pause" is defined here, but 
> I've raised that before, I believe.)

I think we all have a problem with "pause", but I don't know what we can 
do about it. I don't have any pending feedback from you on this topic, as 
far as I can tell.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 2 August 2010 14:20:29 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:59 UTC