From CommonJS Spec Wiki
Jump to: navigation, search

One should probably try to follow the WebWorkers API as far as it makes sense on the server.

However, WebWorkers cannot share state, they can only communicate via messages, so if traditional threads are desired they are not acceptable.

And traditional threads are generally considered deprecated in modern language design. The WebWorkers design was intentional.

  • Intel's River Trail uses "ParallelArray" and elemental functions to address them. There's a prototype build as a Firefox extension. Java JSR-166y embraces this approach, and it's a standard part of Java 7. A Rhino implementation "should" be easy.

A possible alternative is a stronger eventing dispatch mechansim. Actionscript did lots of good work in this area. Here is a set of event, listener and timer classes from Ejscript. These can be retro fitted to interpreters for which threads and threading are problematic or impossible.