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

Re: Synchronous postMessage for Workers?

From: Glenn Maynard <glenn@zewt.org>
Date: Thu, 16 Feb 2012 09:06:48 -0600
Message-ID: <CABirCh8MNYwbynxB8yjW6J6ys+uUA5kGFgj2Jn5SA3J9y4==cA@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: Ian Hickson <ian@hixie.ch>, Joshua Bell <jsbell@chromium.org>, public-webapps@w3.org, David Levin <levin@chromium.org>
On Wed, Feb 15, 2012 at 12:39 AM, Jonas Sicking <jonas@sicking.cc> wrote:

> Put it another way, when you spin the event loop, not only does your
> code need to be prepared for anything happening. All functions up the
> call stack also has to. That makes it very hard to reason about any of
> your code, not just the code that calls yieldUntil.

FWIW, I've used similar mechanisms, such as Lua coroutines, and it worked

The message polling/blocking can be done without spinning the event loop,
of course.  It would be nice to have capabilities like running two sync
XHRs, but with message blocking, you'd be able to do that yourself with a
bit more work (spin up two workers to do the XHRs, then block on response

(By the way, don't forget the "poll a MessageChannel without blocking"
case.  It'd help things like gracefully stopping a long-running operation
rather than having to terminate the worker, which is a pattern I've used a
lot in threaded algorithms in other platforms.)

Glenn Maynard
Received on Thursday, 16 February 2012 15:07:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:31 UTC