Hello,

I would like to write a javascript wrapper around uv_queue_work to deal 
with the case of computationally-expensive functions that shouldn't run in 
the event loop. While obviously this is potentially dangerous, well-written 
code could ensure that the callback called does not touch any state that 
could also potentially be viewed in parallel in the event loop. An example 
might be:

function addInBackground(a,b,cb) {
  var add;
  add = function() {
    return a + b;
  }
  uv_queue_work(add,cb);
}

I know that in my naive guess on how threading could work, this particular 
usage should be safe. My question is: under the hood, is it possible that 
calling the 'add' callback from the work_cb function of uv_queue_work 
manipulates some v8 state in an unsafe way?

Thanks,
Shea

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to