> but i hope it remain running always until invoke uv_stop, cause some
tasks will be add to loop by other thread after uv_run.

You need an async handle for this(cant call libuv API from other threads).
Just add an `uv_async_t` handle to your loop and call `uv_async_send` from
other threads to invoke a callback in the event loop thread. Other threads
can add "tasks" to a queue for the async callback to consume(need to
synchronize with `uv_mutex_t`)


On Fri, Jan 1, 2016 at 11:20 PM 杜如意 <[email protected]> wrote:

> uv_loop_t * loop = uv_loop_new ();
> uv_run (loop, UV_RUN_DEFAULT);
>
> like this sample: there are none handle adding to loop before uv_run, it
> will soon return,
>
> but i hope it remain running always until invoke uv_stop, cause some tasks
> will be add to loop by other thread after uv_run.
>
> and i also hope it remain running after the tasks has been processed(it
> mean that the loop there are none handle again)
>
> thanks in advance
>
> 在 2016年1月2日星期六 UTC+8上午1:43:01,Iñaki Baz Castillo写道:
>>
>> 2016-01-01 12:02 GMT+01:00 杜如意 <[email protected]>:
>> > how to make a uv-loop has been running always even no active handle?
>> >
>> > the UV_RUN_DEFAULT/UV_RUN_ONCE/UV_RUN_NOWAIT mode don't work for my
>> case
>> >
>> > i think add a useless timer but feel graceful,  are there any other
>> way?
>>
>> Which is the use-case of what you want to achieve?
>>
>>
>> --
>> Iñaki Baz Castillo
>>
> <[email protected]>
>>
> --
> 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