Same thread.
I've tried calling it with uv_prepare handle which has a  callback that 
check atomic Boolean for specific condition and upon the results - call 
uv_stop.
the thread continues to block on I/O  ( I assume that since the stack trace 
shows UV_Poll).



On Monday, November 20, 2017 at 1:51:38 PM UTC+2, Ben Noordhuis wrote:
>
> On Mon, Nov 20, 2017 at 10:06 AM,  <[email protected] <javascript:>> 
> wrote: 
> > Hi, 
> > I'm trying to run LibUV loop till I receive a response and then I would 
> like 
> > it to stop (after response was processed) - I might restart the loop at 
> > another time. 
> > I'd like to run the loop in the most non-cpu wasting - which seems to be 
> > UV_RUN_DEFAULT. 
> > 
> > *This is all single threaded. 
> > 
> > To get the loop stopped - I call uv_stop() - but it seems that in some 
> cases 
> > the uv_stop doesn't actually stop the loop and it continues to block. 
> > I guess it's due to the call being made before the loop blocking on I/O 
> and 
> > therefore once called - another iteration is due which blocks on I/O 
> which 
> > is not received. 
> > 
> > I don't want to close all open handles and etc. since the loop might be 
> > reused in another send/receive round. 
> > 
> > 
> > So in short - 
> > is there a way to imminently stop a loop without any additional 
> iteration? 
>
> When and where exactly do you call uv_stop()? 
>
> Do you call it from a different thread than the one executing 
> uv_run()?  That won't work. 
>

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