Thanks Henrik!!<br><br><div class="gmail_quote">On Fri, Aug 13, 2010 at 7:38 AM, Henrik Johansen <span dir="ltr">&lt;<a href="mailto:henrik.s.johansen@veloxit.no">henrik.s.johansen@veloxit.no</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
 <br>I think I figured out why Cog some times terminates when downloading large files on OSX;<br>
An oversleep which is interrupted can be returned as a t_time struct with tv_sec -1 and tv_nsec close to 999999999.<br>
<br>
The while check is<br>
nanosleep (&amp;naptime, &amp;naptime) == -1 &amp;&amp; naptime.tv_sec &gt; 0 1|| naptime.tv_nsec &gt; MINSLEEPNS<br>
<br>
or so, so when an interrupt is encountered which has tv_sec = -1, you will get the invalid argument error.<br>
<br>
rewriting it to<br>
naptime.tvsec &gt; -1 &amp;&amp; naptime.tv_nsec &gt; MINSLEEPNS &amp;&amp; nanosleep(&amp;naptime, &amp;naptime) == -1<br>
<br>
I no longer had  crashes in 99% of hte cases when evaluating the following test:<br>
<br>
HTTPSocket httpGetDocument: &#39;<a href="http://www.squeaksource.com/Pharo/Morphic-stephane_ducasse.334.mcz" target="_blank">http://www.squeaksource.com/Pharo/Morphic-stephane_ducasse.334.mcz</a>&#39;.<br>
<br>
I&#39;ve attached the sqUnixHeartbeat.c.<br>
<br>
Cheers,<br>
Henry<br>
<br>
<br></blockquote></div><br>