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