<div dir="ltr"><br><br><div class="gmail_quote">On Wed, Oct 15, 2008 at 10:34 PM, Kjell Godo <span dir="ltr">&lt;<a href="mailto:squeaklist@gmail.com" target="_blank">squeaklist@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I have noticed that Squeak seems to do Sockets by using Delays for x<br>
milliseconds and then waking back up to do something again.</blockquote><div><br></div><div>Well that is wrong, it just appears that way. As the guy who wrote the vm socket semphore logic, let me explain, there are three smaltalk semphores on a socket, (read, write, control) &nbsp;which means on a socket state change you would get the control sempahore signaled, on a connection accepted, a socket close, a connection error, and a connection&nbsp;reset.&nbsp;&nbsp;</div>

<div><br></div><div>The read semaphore is signalled when data arrives for the socket.&nbsp;</div><div>The write sempahore is signalled when the data is written, which does not mean the data is received by the other party.&nbsp;</div>

<div><br></div><div>This is rather complicated, and an failed attempt was made by Craig Latta to re-implement all this with a product he called &quot;Flow&quot; which he introduced aug 17th of 2002.</div><div><br></div><div>
Now for example if you wanted to read from a socket you would call the read data&nbsp;available&nbsp;primitive&nbsp;primSocketReceiveDataAvailable:, discover no data, and then what? Wlll you wait *forever*? for the read semaphore to be signalled? Well yes, maybe no. &nbsp;For the no case you have Smalltalk code that waits on the read semaphore for so many seconds then fails, then the error recovery &nbsp;does whatever action the programmer decided to do, well like try again? Plus of course then handle issues like the socket being closed.&nbsp;</div>
<div><br></div><div><br></div></div><br clear="all"><br>
-- <br>===========================================================================<br>John M. McIntosh &lt;<a href="mailto:johnmci@smalltalkconsulting.com" target="_blank">johnmci@smalltalkconsulting.com</a>&gt;<br>Corporate Smalltalk Consulting Ltd. &nbsp;<a href="http://www.smalltalkconsulting.com" target="_blank">http://www.smalltalkconsulting.com</a><br>

===========================================================================<br><br><br>
</div>