Alternative to Promise

Benjamin Gruenbaum benjamingr at
Sun Oct 4 08:00:28 UTC 2015

On Sat, Oct 3, 2015 at 5:37 PM, 韩冬 <handong05 at> wrote:

> This is exactly where i’m getting puzzled, suppose we have thread in
> javascript(or whatever to run different things on different cores),
> consider following code:

We don't have threads in JavaScript, and there is no shared memory in most
current environments that support multicore calculations. Those who do have
shared memory do not have *arbitrary* shared memory. If we do choose to
support threads in the future, the algorithms in Promise, as well as in
many other places in the specification would have to drastically change.
Currently, the specification is not thread aware in any way. ECMAScript
implementations typically deal with concurrency though a single threaded
non-blocking event loop model where other heavy computation is offloaded to
processes or to the platform.

> During pending stage, both func1 and func2 are going to pushed into an
> internal array, shouldn’t this array resize operation be protected by a
> lock?

If there are multiple threads then yes. As explained above, ECMAScript
itself has no locks.

> Thanks for your explanations.
> ~winter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list