Admittedly, I'm real shaky on what I'm doing with the thread management, but I did what you said:

    //loop = uv_default_loop();

    uv_work_t req;
    uv_async_init(loop, &async, sendEventFromThreadToNode);
    uv_queue_work(loop, &req, frameWorker, onFrameWorkerThreadComplete);
    //uv_run(loop);
    uv_ref((uv_handle_t *)&async);

    return scope.Close(Undefined());


I actually didn't think it would function properly, since I thought loop would need to be set. But it is working as well as it did before - that is it runs the addon great but in my Javascript, if I do this:

nuimotion.init();
console.log("Hi");

"Hi" does not get written to the console. I appreciate all the help! And I at least have something to simmer on now, which is to really research how to call up threads and determine what blocks and what doesnt

Thanks!
ben

On 03/29/2013 08:08 PM, mscdex wrote:
On Mar 29, 8:05 pm, mscdex <[email protected]> wrote:
On Mar 29, 7:55 pm, Ben Farrell <[email protected]> wrote:

Thanks for looking at this.
Is there a better way to kick off a thread than what I'm doing?
If I simply remove those lines, my thread won't get started, and while
execution won't be blocked anymore, the addon won't do what it's
supposed to do (which is to keep running in the background processing
frames from the device)
Use uv_ref() to keep node from ending early. If you don't have a
uv_handle_t to pass to it, try `uv_ref(uv_default_loop());`.
Ok, so you do have a handle. In your initialize (after removing the
two lines mentioned earlier) do this: uv_ref((uv_handle_t *)&async);


--
--
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

--- You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to