Just wanna thank mscdex for helping me out with this issue. I think I
resolved it.
When I told mscdex that it had worked the same as before in my last
message I think I was mistaken, and I was really getting a crash based
on the new code I put in.
I Googled an old Node message board thread where everyone was first
transitioning to the uv_thread stuff, and picked up something to try.
I removed the loop = uv_default_loop() and uv_run(loop).
I initialized new uv_work_t, instead of just declaring a reference.
I passed in uv_default_loop into init and work, instead of loop (which
used to be set earlier).
uv_work_t *req = new uv_work_t;
uv_async_init(uv_default_loop(), &async, sendEventFromThreadToNode);
uv_queue_work(uv_default_loop(), req, frameWorker,
onFrameWorkerThreadComplete);
uv_ref((uv_handle_t *)&async);
In all honesty, I'm going to have to research and think about what I'm
actually doing, and why it works now....so I feel a little dumb here,
but I am seeing great results, so many thanks!
Hope this helps someone else too!
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.