80
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
1306
|
13 |
"{ Package: 'stx:libbasic2' }"
|
|
14 |
|
80
|
15 |
MessageSend subclass:#MessageChannel
|
1306
|
16 |
instanceVariableNames:''
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Kernel-Methods'
|
80
|
20 |
!
|
|
21 |
|
|
22 |
!MessageChannel class methodsFor:'documentation'!
|
|
23 |
|
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
!
|
|
37 |
|
|
38 |
documentation
|
|
39 |
"
|
|
40 |
MessageChannel provides the same functionality as MessageSend.
|
|
41 |
It has been provided for ST-80 compatibility.
|
|
42 |
|
|
43 |
Like with MessageSend, instances of MessageChannel can be used for
|
|
44 |
simulation programs.
|
|
45 |
They keep some receiver and selector and can be evaluated at any time later.
|
|
46 |
(think of them as a cheaper alternative to blocks).
|
|
47 |
|
|
48 |
In contrast to MessageSend, MessageChannels expect arguments to be passed
|
|
49 |
if all sends are going to the same receiver, use:
|
|
50 |
|
|
51 |
example:
|
|
52 |
|q|
|
|
53 |
|
|
54 |
q := Queue new:120.
|
|
55 |
1 to:100 do:[:i |
|
|
56 |
q nextPut:(MessageChannel receiver:i selector:#+).
|
|
57 |
].
|
|
58 |
[q notEmpty] whileTrue:[
|
|
59 |
|m|
|
|
60 |
|
|
61 |
m := q next.
|
|
62 |
(m value:1) printNL.
|
|
63 |
].
|
|
64 |
"
|
|
65 |
! !
|
|
66 |
|
|
67 |
!MessageChannel class methodsFor:'instance creation'!
|
|
68 |
|
|
69 |
receiver:r selector:sel
|
|
70 |
^ super receiver:r selector:sel arguments:nil
|
|
71 |
! !
|
|
72 |
|
|
73 |
!MessageChannel methodsFor:'evaluation'!
|
|
74 |
|
|
75 |
value
|
|
76 |
"evaluate the messagesend with the original arguments"
|
|
77 |
|
|
78 |
^ receiver perform:selector
|
|
79 |
! !
|
1306
|
80 |
|
|
81 |
!MessageChannel class methodsFor:'documentation'!
|
|
82 |
|
|
83 |
version
|
|
84 |
^ '$Header: /cvs/stx/stx/libbasic2/MessageChannel.st,v 1.5 2003-08-29 19:21:23 cg Exp $'
|
|
85 |
! !
|