Paolo Bonzini wrote:
> You can use two processes.
>
> p1 := [
> source ensureReadable.
> source isPeerAlive ifFalse: [ p1 terminate. p2 terminate ].
> dest nextPutAllFlush: source nextHunk ] newProcess.
> p2 := [
> dest ensureReadable.
> dest isPeerAlive ifFalse: [ p1 terminate. p2 terminate ].
> source nextPutAllFlush: dest nextHunk ] newProcess.
>
> p1 resume.
> p2 resume
>
>
> In 3.0c there is no #nextHunk, so you can use StreamSocket to remove the
> write buffering and do
>
> p1 := [
> source ensureReadable.
> source isPeerAlive ifFalse: [ p1 terminate. p2 terminate ].
> source nextAvailablePutAllOn: dest ] newProcess.
> p2 := [
> dest ensureReadable.
> dest isPeerAlive ifFalse: [ p1 terminate. p2 terminate ].
> dest nextAvailablePutAllOn: source ] newProcess.
>
> p1 resume.
> p2 resume
>
>
> This has better performance because it does not do unnecessary copies
> and creation of objects.
>
> Paolo
>
Thank you Paolo.
I've found this solution extremely helpful. Thanks for putting the "new"
solution in as well - that was going to be the next part of the exercise!
Stephen
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk