On today's Smalltalk Daily, we take a look at class SharedQueue, and how you use it to pass objects between two Smalltalk Processes. Here's the script I used in the screencast:
queue := SharedQueue new.
one := [[true] whileTrue: [| nextItem |
nextItem := queue next.
Transcript show: '--- (one) Received: ', nextItem printString; cr]].
one forkAt: Processor userBackgroundPriority.
two := [1 to: 10 do: [:index |
Transcript show: '(two) Sending: ', index printString; cr.
queue nextPut: index.
(Delay forMilliseconds: 500) wait]].
two fork.
Technorati Tags:
smalltalk, processes, messaging