<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Francis, that’s great, thank you!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Best wishes<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Tony<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Francis Brosnan Blázquez [mailto:francis.brosnan@aspl.es] <br><b>Sent:</b> 19 September 2017 12:41<br><b>To:</b> Tony Mountifield<br><b>Cc:</b> nopoll@lists.aspl.es<br><b>Subject:</b> Re: [noPoll] nopoll_loop_wait(ctx,0) unexpectedly exited<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hello Tony.<br><br><o:p></o:p></p><p class=MsoNormal>OK, looking in the code for nopoll_loop_wait(), it appears the only two ways<br>the loop can exit are:<br>- ctx->keep_looping cets cleared. This only happens in nopoll_loop_stop()<br>- the wait operation exits with -1 for some reason<o:p></o:p></p><p class=MsoNormal><br>That's right.<br><br><br><o:p></o:p></p><p class=MsoNormal>I didn't have nopoll logging enabled, so can't tell if it was the second.<o:p></o:p></p><p class=MsoNormal><br>Ok.<br><br><br><o:p></o:p></p><p class=MsoNormal>It looks like I could recover from the latter situation with the kludge:<br><br>  do {<br>    nopoll_loop_wait(ctx,0);<br>  } while(ctx->keep_looping);<br><br>That would re-invoke it if it had exited abnormally due to a wait error.<o:p></o:p></p><p class=MsoNormal><br>That would do in essense. To complete this, I've updated<br>nopoll_loop_wait code to report -3 for timeout errors and -4 for I/O<br>wait engine errors.<br><br><a href="https://github.com/ASPLes/nopoll/commit/41d06366b1f814a32feff58ef2d4906a25b3a37e">https://github.com/ASPLes/nopoll/commit/41d06366b1f814a32feff58ef2d4906a25b3a37e</a><br><br>This way you can extend your solution to only keep on looping on this<br>condition.<br><br><a href="https://github.com/ASPLes/nopoll/blob/master/src/nopoll_loop.c#L214">https://github.com/ASPLes/nopoll/blob/master/src/nopoll_loop.c#L214</a><br><br>Best Regards.<br><br><br><o:p></o:p></p><p class=MsoNormal>Cheers<br>Tony<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>