Here's the naive worker pool implementation I was thinking about. It requires 
that the browser fires an event everytime a core becomes available (only in an 
active tab of course), and provide a property that tells whether or not a core 
is available at a given time:

// a handler that runs when a job is added to the queue or when a core becomes 
available
jobHandler() {
  if ( isJobInTheQueue && isCoreAvailable ) {
    if ( noWorkerAvailable ) {
      pool.spawnWorker();
    }
    pool.distribute( queue.pullJob() );
  }
}

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to