Future.st
author Stefan Vogel <sv@exept.de>
Mon, 15 Dec 2014 19:56:01 +0100
changeset 3455 4467a141f5eb
parent 3064 7fe7e32ae4dd
child 3848 9a227b37e76b
permissions -rw-r--r--
class: Future changed: #doesNotUnderstand: catch more debugging messages
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1140
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
     1
"
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
     2
 This is a Manchester Goodie protected by copyright.
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
     3
 These conditions are imposed on the whole Goodie, and on any significant
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
     4
 part of it which is separately transmitted or stored:
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
     5
	* You must ensure that every copy includes this notice, and that
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
     6
	  source and author(s) of the material are acknowledged.
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
     7
	* These conditions must be imposed on anyone who receives a copy.
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
     8
	* The material shall not be used for commercial gain without the prior
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
     9
	  written consent of the author(s).
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    10
 Further information on the copyright conditions may be obtained by
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    11
 sending electronic mail:
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    12
	To: goodies-lib@cs.man.ac.uk
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    13
	Subject: copyright
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    14
 or by writing to The Smalltalk Goodies Library Manager, Dept of
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    15
 Computer Science, The University, Manchester M13 9PL, UK
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    16
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    17
 (C) Copyright 1992 University of Manchester
2341
36e455705ee6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
    18
 For more information about the Manchester Goodies Library (from which
1140
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    19
 this file was distributed) send e-mail:
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    20
	To: goodies-lib@cs.man.ac.uk
2341
36e455705ee6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
    21
	Subject: help
1140
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    22
"
2341
36e455705ee6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
    23
"{ Package: 'stx:libbasic2' }"
457
c862c91716b6 packages
Claus Gittinger <cg@exept.de>
parents: 351
diff changeset
    24
1327
cf928a994f81 comments
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
    25
ProtoObject subclass:#Future
1140
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    26
	instanceVariableNames:'result semaphore'
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    27
	classVariableNames:''
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    28
	poolDictionaries:''
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
    29
	category:'Kernel-Processes'
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
    30
!
a759b5c72c98 Initial revision
claus
parents:
diff changeset
    31
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    32
!Future class methodsFor:'documentation'!
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    33
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    34
copyright
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    35
"
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    36
 This is a Manchester Goodie protected by copyright.
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    37
 These conditions are imposed on the whole Goodie, and on any significant
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    38
 part of it which is separately transmitted or stored:
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    39
	* You must ensure that every copy includes this notice, and that
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    40
	  source and author(s) of the material are acknowledged.
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    41
	* These conditions must be imposed on anyone who receives a copy.
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    42
	* The material shall not be used for commercial gain without the prior
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    43
	  written consent of the author(s).
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    44
 Further information on the copyright conditions may be obtained by
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    45
 sending electronic mail:
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    46
	To: goodies-lib@cs.man.ac.uk
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    47
	Subject: copyright
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    48
 or by writing to The Smalltalk Goodies Library Manager, Dept of
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    49
 Computer Science, The University, Manchester M13 9PL, UK
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    50
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    51
 (C) Copyright 1992 University of Manchester
2341
36e455705ee6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
    52
 For more information about the Manchester Goodies Library (from which
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    53
 this file was distributed) send e-mail:
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    54
	To: goodies-lib@cs.man.ac.uk
2341
36e455705ee6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
    55
	Subject: help
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    56
"
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    57
!
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    58
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    59
documentation
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    60
"
3064
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    61
    I represent an execution in progress, which will be required some time
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    62
    in the future.
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    63
    I will immediately start execution in a separate process,
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    64
    but delay any messages sent to me, until the execution has completed.
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    65
    This is useful for time consuming operations (print jobs, compile jobs etc.),
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    66
    which can be done in the background and the user can do something else
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    67
    in the meantime. If the computation is finished before the user needs its
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    68
    value, he is not forced to wait.
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    69
    If the computation is unfinished, he has to wait for the remaining time only.
1327
cf928a994f81 comments
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
    70
2341
36e455705ee6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
    71
    [author:]
3064
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    72
        tph@cs.man.ac.uk
1516
08829dfb29fe comment
Stefan Vogel <sv@exept.de>
parents: 1514
diff changeset
    73
08829dfb29fe comment
Stefan Vogel <sv@exept.de>
parents: 1514
diff changeset
    74
    [see also:]
3064
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    75
        Block Lazy LazyValue
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    76
"
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    77
!
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    78
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    79
examples
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    80
"
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    81
  Starts evaluating the factorial immediately, but waits until
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    82
  the result is available before printing the answer
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
    83
                                                                    [exBegin]
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    84
    | fac |
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    85
1516
08829dfb29fe comment
Stefan Vogel <sv@exept.de>
parents: 1514
diff changeset
    86
    fac := [5000 factorial] futureValue.
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    87
    Transcript showCR: 'evaluating factorial...'.
3064
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
    88
    Dialog information:'You can do something useful now...'.
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
    89
    Transcript showCR: fac
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
    90
                                                                    [exEnd]
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    91
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    92
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    93
  An example illustrating the use of multiple futures and
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    94
  explicit resynchronisation.
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    95
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    96
  Starts evaluating both factorials immediately, but waits until
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    97
  both blocks have finished before continuing.
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
    98
                                                                    [exBegin]
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
    99
    | fac1 fac2 |
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   100
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   101
    fac1 := [Transcript showCR: 'Starting fac1.. '. 1000 factorial] futureValue.
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   102
    fac2 := [Transcript showCR: 'Starting fac2.. '. 2000 factorial] futureValue.
1516
08829dfb29fe comment
Stefan Vogel <sv@exept.de>
parents: 1514
diff changeset
   103
    fac2 isString.
08829dfb29fe comment
Stefan Vogel <sv@exept.de>
parents: 1514
diff changeset
   104
    fac1 isString.
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   105
    Transcript showCR: 'both completed.'.
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   106
                                                                    [exEnd]
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   107
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   108
  Example showing how arguments may be passed to futures.
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   109
                                                                    [exBegin]
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   110
    | temp |
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   111
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   112
    temp := [:x :y | 10 * x * y] futureValue: 3 value: 4.
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   113
    Transcript  showCR: temp.
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   114
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   115
                                                                    [exEnd]
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   116
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   117
  Claus:
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   118
    The above examples do not really show the power of Futures;
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   119
    they can be useful, whenever some long-time computation is
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   120
    to be done, and some other useful work can be done in the meanwhile.
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   121
    for example:
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   122
3064
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
   123
    Without futures, the inputfile is read before opening the view;
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
   124
    the readTime and view creation times sum up:
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   125
                                                                    [exBegin]
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   126
        |p text v|
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   127
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   128
        p := PipeStream readingFrom:'ls -l /bin /usr/bin /usr/lib'.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   129
        text := p contents.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   130
        p close.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   131
        v := TextView new openAndWait.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   132
        v contents:text
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   133
                                                                    [exEnd]
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   134
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   135
    The same here:
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   136
                                                                    [exBegin]
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   137
        |p text v|
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   138
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   139
        v := TextView new openAndWait.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   140
        p := PipeStream readingFrom:'ls -l /bin /usr/bin /usr/lib'.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   141
        text := p contents.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   142
        p close.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   143
        v contents:text
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   144
                                                                    [exEnd]
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   145
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   146
3064
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
   147
    With futures, the view creation and reading are done in parallel:
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
   148
    (if the windowing system is slow when opening the view, the contents may
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
   149
     be already available - especially on X window systems, where the user
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
   150
     has to provide the window position with the mouse)
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   151
                                                                    [exBegin]
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   152
        |p text v|
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   153
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   154
        text := [   |p t|
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   155
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   156
                    p := PipeStream readingFrom:'ls -l /bin /usr/bin /usr/lib'.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   157
                    t := p contents.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   158
                    p close.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   159
                    t
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   160
                ] futureValue.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   161
        v := TextView new openAndWait.
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   162
        v contents:text
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   163
                                                                    [exEnd]
484
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   164
"
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   165
! !
d50c08ae6e3d documentation
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   166
1140
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   167
!Future methodsFor:'evaluating'!
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   168
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   169
block:aBlock
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   170
    "Execute aBlock in parallel with whatever called me, but
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   171
     ensure that any messages sent to me before execution
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   172
     of the block has terminated are suspended until it has terminated."
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   173
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   174
    semaphore := Semaphore new name:'Future'.
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   175
    [result := aBlock ensure:[semaphore signal]] fork
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   176
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   177
    "Modified (format): / 04-10-2011 / 14:54:11 / cg"
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   178
!
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   179
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   180
block:aBlock value:aValue
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   181
    "Execute aBlock in parallel with whatever called me, but
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   182
     ensure that any messages sent to me before execution
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   183
     of the block has terminated are suspended until it has terminated."
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   184
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   185
    semaphore := Semaphore new name:'Future'.
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   186
    [
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   187
        result := [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   188
            aBlock value:aValue
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   189
        ] ensure:[semaphore signal]
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   190
    ] fork
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   191
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   192
    "Modified (format): / 04-10-2011 / 14:54:18 / cg"
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   193
!
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   194
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   195
block:aBlock value:value1 value:value2
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   196
    "Execute aBlock in parallel with whatever called me, but
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   197
     ensure that any messages sent to me before execution
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   198
     of the block has terminated are suspended until it has terminated."
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   199
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   200
    semaphore := Semaphore new name:'Future'.
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   201
    [
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   202
        result := [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   203
            aBlock value:value1 value:value2
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   204
        ] ensure:[semaphore signal]
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   205
    ] fork
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   206
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   207
    "Modified (format): / 04-10-2011 / 14:54:28 / cg"
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   208
!
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   209
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   210
block:aBlock value:value1 value:value2 value:value3
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   211
    "Execute aBlock in parallel with whatever called me, but
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   212
     ensure that any messages sent to me before execution
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   213
     of the block has terminated are suspended until it has terminated."
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   214
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   215
    semaphore := Semaphore new name:'Future'.
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   216
    [
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   217
        result := [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   218
            aBlock value:value1 value:value2 value:value3
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   219
        ] ensure:[semaphore signal]
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   220
    ] fork
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   221
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   222
    "Modified (format): / 04-10-2011 / 14:54:45 / cg"
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   223
!
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   224
2667
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   225
block:aBlock valueWithArguments:anArray
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   226
    "Execute aBlock in parallel with whatever called me, but
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   227
     ensure that any messages sent to me before execution
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   228
     of the block has terminated are suspended until it has terminated."
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   229
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   230
    semaphore := Semaphore new name:'Future'.
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   231
    [
2667
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   232
        result := [
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   233
            aBlock valueWithArguments:anArray
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   234
        ] ensure:[semaphore signal]
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   235
    ] fork
2667
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   236
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   237
    "Modified (format): / 04-10-2011 / 14:55:09 / cg"
2666
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   238
!
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   239
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   240
priority:prio block: aBlock
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   241
    "Execute aBlock in parallel with whatever called me, but
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   242
     ensure that any messages sent to me before execution
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   243
     of the block has terminated are suspended until it has terminated."
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   244
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   245
    semaphore := Semaphore new name:'Future'.
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   246
    [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   247
        result := aBlock ensure:[semaphore signal]
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   248
    ] forkAt:prio
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   249
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   250
    "Created: / 04-10-2011 / 14:53:21 / cg"
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   251
!
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   252
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   253
priority:prio block: aBlock value: aValue
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   254
    "Execute aBlock in parallel with whatever called me, but
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   255
     ensure that any messages sent to me before execution
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   256
     of the block has terminated are suspended until it has terminated."
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   257
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   258
    semaphore := Semaphore new name:'Future'.
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   259
    [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   260
        result := [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   261
            aBlock value:aValue
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   262
        ] ensure:[semaphore signal]
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   263
    ] forkAt:prio
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   264
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   265
    "Created: / 04-10-2011 / 14:53:35 / cg"
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   266
!
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   267
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   268
priority:prio block:aBlock value:value1 value:value2
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   269
    "Execute aBlock in parallel with whatever called me, but
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   270
     ensure that any messages sent to me before execution
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   271
     of the block has terminated are suspended until it has terminated."
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   272
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   273
    semaphore := Semaphore new name:'Future'.
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   274
    [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   275
        result := [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   276
            aBlock value:value1 value:value2
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   277
        ] ensure:[semaphore signal]
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   278
    ] forkAt:prio
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   279
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   280
    "Created: / 04-10-2011 / 14:54:03 / cg"
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   281
!
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   282
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   283
priority:prio block:aBlock value:value1 value:value2 value:value3
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   284
    "Execute aBlock in parallel with whatever called me, but
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   285
     ensure that any messages sent to me before execution
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   286
     of the block has terminated are suspended until it has terminated."
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   287
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   288
    semaphore := Semaphore new name:'Future'.
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   289
    [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   290
        result := [
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   291
            aBlock value:value1 value:value2 value:value3
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   292
        ] ensure:[semaphore signal]
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   293
    ] forkAt:prio
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   294
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
   295
    "Created: / 04-10-2011 / 14:54:51 / cg"
2667
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   296
!
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   297
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   298
priority:prio block:aBlock valueWithArguments:anArray
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   299
    "Execute aBlock in parallel with whatever called me, but
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   300
     ensure that any messages sent to me before execution
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   301
     of the block has terminated are suspended until it has terminated."
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   302
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   303
    semaphore := Semaphore new name:'Future'.
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   304
    [
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   305
        result := [
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   306
            aBlock valueWithArguments:anArray
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   307
        ] ensure:[semaphore signal]
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   308
    ] forkAt:prio
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   309
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   310
    "Created: / 04-10-2011 / 14:55:14 / cg"
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   311
! !
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   312
1140
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   313
!Future methodsFor:'synchronising'!
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   314
2341
36e455705ee6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1516
diff changeset
   315
doesNotUnderstand:aMessage
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   316
    "Any message to a Future will end up here."
2669
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   317
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   318
    result isNil ifTrue:[
2828
8894852ab900 Use IsDebuggingQuery
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   319
        IsDebuggingQuery query ifTrue:[
3455
4467a141f5eb class: Future
Stefan Vogel <sv@exept.de>
parents: 3064
diff changeset
   320
            (#(instVarAt: isKindOf:) includes:aMessage selector) ifTrue:[
2828
8894852ab900 Use IsDebuggingQuery
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   321
                "enable debugging / inspecting"
3455
4467a141f5eb class: Future
Stefan Vogel <sv@exept.de>
parents: 3064
diff changeset
   322
                ^ (Object compiledMethodAt:aMessage selector)
2828
8894852ab900 Use IsDebuggingQuery
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   323
                    valueWithReceiver:self
8894852ab900 Use IsDebuggingQuery
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   324
                    arguments:aMessage arguments
3455
4467a141f5eb class: Future
Stefan Vogel <sv@exept.de>
parents: 3064
diff changeset
   325
                    selector:aMessage selector
2828
8894852ab900 Use IsDebuggingQuery
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   326
             ].
8894852ab900 Use IsDebuggingQuery
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   327
        ] ifFalse:[
8894852ab900 Use IsDebuggingQuery
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   328
            semaphore waitUncounted. "Wait for evaluation to complete"
8894852ab900 Use IsDebuggingQuery
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   329
                                     "(if not already completed)"
8894852ab900 Use IsDebuggingQuery
Stefan Vogel <sv@exept.de>
parents: 2669
diff changeset
   330
        ].
2669
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   331
    ].
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   332
    ^ result perform:aMessage selector withArguments:aMessage arguments
2668
67b51e1ee66d changed:
Claus Gittinger <cg@exept.de>
parents: 2667
diff changeset
   333
2669
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   334
    "Modified: / 04-10-2011 / 17:37:18 / cg"
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   335
!
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   336
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   337
value
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   338
    result isNil ifTrue:[
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   339
        semaphore waitUncounted. "Wait for evaluation to complete"
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   340
                                 "(if not already completed)"
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   341
    ].
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   342
    ^ result
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   343
a01e7c23bf61 added: #value
Claus Gittinger <cg@exept.de>
parents: 2668
diff changeset
   344
    "Created: / 04-10-2011 / 17:36:06 / cg"
1140
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   345
! !
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   346
1327
cf928a994f81 comments
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
   347
!Future methodsFor:'testing'!
cf928a994f81 comments
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
   348
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   349
hasValue
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   350
    ^ result notNil or:[semaphore wouldBlock not]
2668
67b51e1ee66d changed:
Claus Gittinger <cg@exept.de>
parents: 2667
diff changeset
   351
67b51e1ee66d changed:
Claus Gittinger <cg@exept.de>
parents: 2667
diff changeset
   352
    "Modified: / 04-10-2011 / 17:29:36 / cg"
1514
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   353
!
83af7e61d415 Inherit from protoObject.
Stefan Vogel <sv@exept.de>
parents: 1327
diff changeset
   354
1327
cf928a994f81 comments
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
   355
isLazyValue
2829
e84f89563562 changed:
Stefan Vogel <sv@exept.de>
parents: 2828
diff changeset
   356
    ^ result isNil and:[semaphore isNil or:[semaphore wouldBlock]]
1327
cf928a994f81 comments
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
   357
! !
cf928a994f81 comments
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
   358
1140
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   359
!Future class methodsFor:'documentation'!
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   360
cbb20fd710fa added #hasValue
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
   361
version
3455
4467a141f5eb class: Future
Stefan Vogel <sv@exept.de>
parents: 3064
diff changeset
   362
    ^ '$Header: /cvs/stx/stx/libbasic2/Future.st,v 1.19 2014-12-15 18:56:01 stefan Exp $'
2667
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   363
!
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   364
e65a29b55fe1 added: #priority:block:valueWithArguments:
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   365
version_CVS
3455
4467a141f5eb class: Future
Stefan Vogel <sv@exept.de>
parents: 3064
diff changeset
   366
    ^ '$Header: /cvs/stx/stx/libbasic2/Future.st,v 1.19 2014-12-15 18:56:01 stefan Exp $'
62
a759b5c72c98 Initial revision
claus
parents:
diff changeset
   367
! !
3064
7fe7e32ae4dd class: Future
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
   368