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

Re: [IndexedDB] Why rely on run-to-completion?

From: Jonas Sicking <jonas@sicking.cc>
Date: Thu, 30 Dec 2010 15:08:50 -0800
Message-ID: <AANLkTimwYbxS81pN-MgcHz4xA83au+8=aVQZUzEqEmmF@mail.gmail.com>
To: Keean Schupke <keean@fry-it.com>
Cc: Axel Rauschmayer <axel@rauschma.de>, public-webapps@w3.org
On Thu, Dec 30, 2010 at 2:19 PM, Keean Schupke <keean@fry-it.com> wrote:
> The JavaScript engine we have implemented has interpreter continuations. So
> at bytecode boundaries it is able to process pending events. (not saying it
> currently does this, but it may in the future). This is not multi-threading,
> there is only one thread per "engine" which maintains an interpreter
> environment and communicates with other engines by message passing (we
> already have a worker API, although non-standard).
> This could cause a problem with the current API. The fix for this is to make
> sure the callbacks are defined before the function using the callbacks is
> called.
> I think keeping away from multi-threading in JS is sensible (perhaps Erlang
> style multi-processing would be good though). However "interrupting" the
> interpreter to process callbacks is just a single thread and causes no
> problems providing the callbacks are initialised before the call that
> initialises the background process that will generate the asynchronous
> event.

If you are interrupting at arbitrary points in the execution and
running other script contexts which can synchronously call into the
first javascript context, then you are implementing multithreading.
This is in fact exactly how multithreading works on single-core CPUs.
It means that you are exposing race conditions and all other threading
hazards to webpages.

/ Jonas
Received on Thursday, 30 December 2010 23:09:43 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:42 GMT