- From: Scott Hess <shess@google.com>
- Date: Thu, 10 Sep 2009 16:50:32 -0700
On Thu, Sep 10, 2009 at 2:38 PM, James Robinson<jamesr at google.com> wrote: > I also strongly feel that giving web > developers access to locking mechanisms is a bad idea - it hasn't been a > spectacular success in any other language. I think that you can either give web developers a strong set of concurrent-programming primitives, or you can give them a weak set and let them make up what they think they need out of those. ?The nice thing about providing a very basic primitives is that it's more likely that good developers can compose higher-level operations with the primitives. A few years back I proposed to some coworkers that it would be interesting to model JavaScript IPC on an existing well-formed system, such as Mach. ?On the surface, that sounds crazy, but once someone finds that they need to figure out how to have some code process a MessagePort in database transaction under a critical section, well, then it makes more sense to have modeled the primitives on a research project rather than be added in an ad hoc fashion. > I think the useful semantics are equivalent to the following (being careful > to avoid mentioning 'locks' or 'mutexes' explicit): ?A script passes in a > callback and a token. ?The UA invokes the callback at some point in the > future and provides the guarantee that no other callback with that token > will be invoked in any context within the origin until the invoked callback > returns. ?Here's what I mean with an intentionally horrible name: > window.runMeExclusively(callback, "arbitrary string token"); Maybe: ? window.runCriticalSection(callback, "identifier"); -scott
Received on Thursday, 10 September 2009 16:50:32 UTC