W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2011

Re: LocalStorage inside Worker

From: Keean Schupke <keean@fry-it.com>
Date: Fri, 7 Jan 2011 10:33:34 +0000
Message-ID: <AANLkTimykqZ9OJr_tji675sagcg1xeAZEDk5ux0kdBae@mail.gmail.com>
To: Glenn Maynard <glenn@zewt.org>
Cc: Felix Halim <felix.halim@gmail.com>, Jonas Sicking <jonas@sicking.cc>, Jeremy Orlow <jorlow@chromium.org>, public-webapps WG <public-webapps@w3.org>
I suggest people read about Software Transactional Memory before trying to
re-invent the wheel. Minds immeasurably superior to our own (spoken in the
voice of Richard Burton) have already thought long and hard about this.

- It solves the efficiency problem
- It solves the long transaction problem
- Transactions are composable! (big win)

It also has the following advantages (quoted from the tutorial I posted):

- No race conditions due to forgotten locks
- No deadlocks resulting from inconsistent lock ordering
- No Corruption caused by uncaught exceptions
- No lost wakeups induced by omitted notifications

The API presented to the user is very similar to others proposed, it is the
semantics that are different.


Cheers,
Keean.


On 7 January 2011 09:58, Glenn Maynard <glenn@zewt.org> wrote:

> On Fri, Jan 7, 2011 at 12:30 AM, Felix Halim <felix.halim@gmail.com>
> wrote:
> > The usage of localStorage in the main page thread is much uglier than
> > any spaghetti code. Any callback could update it. Currently, everybody
> > uses the localStorage in synchronous mode in the main page thread and
> > assumes no other theads can modify it. Allowing workers to change its
> > value (even in atomic asynchronous mode) will breaks all current
> > applications.
>
> In that case, all current applications are already broken in Chrome.
>
> A solution that makes localStorage read-only in workers is no
> solution.  "Cripple the API" isn't an answer.  I think Jonas's async
> callback approach, modulo the comments I made earlier, is the sanest
> approach suggested so far.  It makes localStorage *fully* accessible
> from workers, and also likely improves the unimplemented-storage-mutex
> situation in Chrome, which exists even without workers.
>
> --
> Glenn Maynard
>
>
Received on Friday, 7 January 2011 10:34:09 GMT

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