Using UV_RUN_ONCE will block your loop if there are no libuv events, but
the nowait option could work.  Also there is a way to integrate file
descriptors into libuv's event loop I believe.  It depends on the nature of
your existing loop.

Assuming you don't block while waiting for events, performance shouldn't be
a problem.  I don't expect it to make your mainloop slow.  I've benchmarked
libuv servers running hundreds of thousands of requests per second on
laptops.  I assume your animation loop if not faster than 60fps.

On Thu, Feb 25, 2016 at 6:59 PM, Xpol Wan <[email protected]> wrote:

> Hi,
>
>
> I currently using *cocos2d-x* with *Lua* for mobile game client side
> programming and searching for a network library (mainly for TCP).
>
>
> I'm consider use libuv or luv <https://github.com/luvit/luv> (a Lua
> binding for libuv) :
>
>
> Running libuv loop in *UV_RUN_ONCE* or *UV_RUN_NOWAIT* mode each frame in
> game main loop (main thread).
>
> When libuv received networking data, it calls my callback Lua functions in
> game main thread (where the Lua VM runs), and my Lua code decrypt and
> decode and process the message.
>
>
> My question is:
>
>    1.
>
>    1. will libuv make my game mainloop slow and drop my fps when
>    networking traffic goes up (of course when within a reasonable message size
>    and amount)?
>    2.
>
>    2. need I put libuv loop in another thread and wrap the callback delay
>    called my Lua functions in main thread?
>
> Thank you very much!
>
> Xpol Wan
>
> --
> You received this message because you are subscribed to the Google Groups
> "libuv" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/libuv.
> For more options, visit https://groups.google.com/d/optout.
>

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

Reply via email to