[Bug 15007] Add an API to queue a task

https://www.w3.org/Bugs/Public/show_bug.cgi?id=15007

--- Comment #29 from Glenn Maynard <glenn@zewt.org> 2011-12-06 22:41:02 UTC ---
That spec
(https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html)
definitely requires that this code:

setImmediate(function() { console.log("x2"); });
setImmediate(function() { console.log("x3"); });
console.log("x1");

print "x1 x2 x3", and never "x1 x3 x2".  Step 6 of setImmediate ("Wait until
any invocations ...") ensures that the tasks are queued in the order
setImmediate is called.

Your code may print "x1 x3 x2", if the MessageChannel task queues happen to be
run in that order.  To ensure correct ordering, you a single MessageChannel
should be used for all calls, as was done above.

(I think there are fundamental issues with the "efficient script yielding"
spec, and I doubt it'll see general adoption in that form, but it does get the
task ordering right.)

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 6 December 2011 22:41:10 UTC