[noPoll] nopoll_loop_wait(ctx,0) unexpectedly exited

Tony Mountifield tony en softins.co.uk
Mar Sep 19 14:27:50 CEST 2017


Hi Francis, that’s great, thank you!

 

I would only make one small comment. If a non-zero timeout is given to nopoll_loop_wait(), then exiting after that timeout expires should probably not be considered an error, as it is what the programmer intended, so returning 0 may be better, as at present. Maybe someone already uses it in this way and is careful about error checking. They may be surprised by the -3.

 

Best wishes

Tony

 

From: Francis Brosnan Blázquez [mailto:francis.brosnan at aspl.es] 
Sent: 19 September 2017 12:41
To: Tony Mountifield
Cc: nopoll at lists.aspl.es
Subject: Re: [noPoll] nopoll_loop_wait(ctx,0) unexpectedly exited

 

Hello Tony.



OK, looking in the code for nopoll_loop_wait(), it appears the only two ways
the loop can exit are:
- ctx->keep_looping cets cleared. This only happens in nopoll_loop_stop()
- the wait operation exits with -1 for some reason


That's right.




I didn't have nopoll logging enabled, so can't tell if it was the second.


Ok.




It looks like I could recover from the latter situation with the kludge:

  do {
    nopoll_loop_wait(ctx,0);
  } while(ctx->keep_looping);

That would re-invoke it if it had exited abnormally due to a wait error.


That would do in essense. To complete this, I've updated
nopoll_loop_wait code to report -3 for timeout errors and -4 for I/O
wait engine errors.

https://github.com/ASPLes/nopoll/commit/41d06366b1f814a32feff58ef2d4906a25b3a37e

This way you can extend your solution to only keep on looping on this
condition.

https://github.com/ASPLes/nopoll/blob/master/src/nopoll_loop.c#L214

Best Regards.




Cheers
Tony

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.aspl.es/pipermail/nopoll/attachments/20170919/c8fd78ca/attachment.html>


Más información sobre la lista de distribución noPoll