W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

Re: Web workers: synchronously handling events

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 28 Dec 2010 12:06:01 -0800
Message-ID: <AANLkTimjyJN=iESg0uG7KkM=-D3qYJGH0WbfEarGzL_x@mail.gmail.com>
To: Glenn Maynard <glenn@zewt.org>
Cc: public-webapps@w3.org
On Sun, Dec 26, 2010 at 4:29 PM, Glenn Maynard <glenn@zewt.org> wrote:
> Havn't been able to find this in the spec: is there a way to allow
> processing messages synchronously during a number-crunching worker
> thread?

Yes, by pausing every once in a while with setTimeout and letting the
event loop spin.

Doing anything else would break javascript's appearance of single-threadedness.

I agree that it's not particularly nice to write your algorithms like
this, but it's already familiar to any js dev who uses any algorithm
with significant running time.  If we were to fix this, it needs to be
done at the language level, because there are language-level issues to
be solved that can't be hacked around by a specialized solution.

Received on Tuesday, 28 December 2010 20:06:54 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:28 UTC