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