Re: Synchronous postMessage for Workers?

On Thu, Nov 17, 2011 at 6:17 PM, Rick Waldron <waldron.rick@gmail.com>wrote:

> No, it's not. Messaging should not block either process.
>

No, it's perfectly fine to block a worker, as long as the worker explicitly
requests it and is expecting it.

I don't know what that means.  Synchronous APIs are one of the major
> reasons to have Workers in the first place.
>
> Considering the current messaging API and the allowed host APIs, I
> strongly disagree.
>

I'm not quite sure what you mean by "allowed host APIs", but there are lots
of synchronous APIs in Workers: File API, Filesystem API, IndexedDB.  These
are all new APIs, not historical accidents (like sync XHR in the UI
thread).  Synchronous (blocking) APIs in workers is entirely by design, in
order to allow writing clean, linear code instead of code that has to yield
to the calling environment all the time.

-- 
Glenn Maynard

Received on Thursday, 17 November 2011 23:50:35 UTC