Ben Noordhuis wrote: > > > uv_thread_create() is your best option but, as you mention, it's not > available in v0.6. > I switched over to uv_queue_work() and uv_thread_create() (depending on NODE_VERSION_AT_LEAST as mention in this mail thread). Still not sure about queue_work but I can still change this later.
Don't do that. libuv is *not* thread-safe with the sole exception of > uv_async_send(). > > Set up an async handle before you create the worker thread. When the > thread is about to quit, have it wake up the main thread with > uv_async_send(). Unref the loop and close the handle in your callback. > (That's for v0.6. In v0.8, you only need to close the handle.) > With uv_queue_work Node will automatically stay open until the thread quits. Do I still need uv_ref or this async_send stuff? What I need but yet have to implement is that the Node's main thread will stay alive and can handle callbacks just like with any other async addon or like a web server that stays alive and responses to incoming connections. > I idle in #libuv on freenode.org, feel free to pop in and ask questions. > Thanks, I'll join and bug you when I have further questions/problems. ;) -- 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
