Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Commit

Permalink
Replace WorkerMaster with per-worker listeners.
Browse files Browse the repository at this point in the history
- Fixes a bunch (it turns out) async-related bugs in
  WorkerMaster.maybeDestroy().
- Gets rid of HANDSHAKE message since each worker has its own dedicated
  socket.
- Rename WorkerImpl to Worker, as all implemnetation details can now be
  hidden. Some were formerly exposed for use by WorkerMaster.
  • Loading branch information
pgriess committed Jun 11, 2010
1 parent 3aea6c5 commit 5244c8d
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 212 deletions.
3 changes: 0 additions & 3 deletions lib/webworker-child.js
Expand Up @@ -108,9 +108,6 @@ var ms = new wwutil.MsgStream(s);

// Once we connect successfully, set up the rest of the world
s.addListener('connect', function() {
// Perform handshaking
ms.send([wwutil.MSGTYPE_HANDSHAKE, process.pid]);

// When we receive a message from the master, react and possibly
// dispatch it to the worker context
ms.addListener('msg', handleMessage);
Expand Down
5 changes: 2 additions & 3 deletions lib/webworker-util.js
Expand Up @@ -18,9 +18,8 @@ var STACK_FRAME_RE = /.* \(?(.+:\d+:\d+)\)?$/;

// Symbolic names for our messages types
exports.MSGTYPE_NOOP = 0;
exports.MSGTYPE_HANDSHAKE = 1;
exports.MSGTYPE_ERROR = 2;
exports.MSGTYPE_CLOSE = 3;
exports.MSGTYPE_ERROR = 1;
exports.MSGTYPE_CLOSE = 2;
exports.MSGTYPE_USER = 100;

// Is the given message well-formed?
Expand Down

0 comments on commit 5244c8d

Please sign in to comment.