[squeak-dev] Resuming a SocketStream after a ConnectionClosed exception?

tim Rowledge tim at rowledge.org
Wed Feb 15 21:34:34 UTC 2017


Hi Göran!

> On 15-02-2017, at 3:50 AM, Göran Krampe <goran at krampe.se> wrote:
> 

> I wrote the current incarnation of SocketStream and I intentionally did not add any semaphore/mutex for protections. And yes, the SocketStream has internal state to know positions in buffers etc etc - so NO, you should not use two Processes with the same SocketStream.
> 
> Having said that...  if you have one process only writing and one only reading - you may get away with it - IIRC (no promises) the inBuffer and outBuffer (and associated ivars) may be 100% separated.

A single process to write and another to read, both at same priority so only one can be  doing stuff at once. The reader will wait on data coming in, the writer on packets being available in a shared queue. I *think* that makes it safe from what I can make out of the code.

If anyone has suggestions on a better way to do this I’d be very happy to learn.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: RSC: Rewind System Clock




More information about the Squeak-dev mailing list