BackgroundJob.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 21 Feb 2015 11:03:13 +0100
changeset 3493 e7c920efe4cc
parent 2976 e1da8a03d161
child 3505 148aeaa05f75
permissions -rw-r--r--
Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2587
e149cfcded61 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2585
diff changeset
     1
"{ Package: 'stx:libbasic2' }"
2574
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
3493
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
     3
"{ NameSpace: Smalltalk }"
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
     4
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
     5
AbstractBackgroundJob subclass:#BackgroundJob
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
     6
	instanceVariableNames:''
2574
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	classVariableNames:''
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	poolDictionaries:''
2590
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
     9
	category:'System-Support'
2574
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
!
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
!BackgroundJob class methodsFor:'documentation'!
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
2590
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
    14
documentation
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
    15
"
3493
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
    16
    A BackgroundJob for one-shot computation. When started, it performs it job
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
    17
    and terminates. User have to explicitly ask job to start again to 
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
    18
    perform new computation.
2602
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    19
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    20
    [author:]
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    21
        Jan Vrany <jan.vrany@fit.cvut.cz>
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    22
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    23
    [instance variables:]
3493
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
    24
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
    25
    [class variables:]
2602
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    26
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    27
    [see also:]
3493
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
    28
        BackgroundJob
2602
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    29
"
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    30
!
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    31
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    32
examples
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    33
"
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    34
    | job text |
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    35
    job :=  BackgroundJob named: 'example job' on:[
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    36
                Delay waitForSeconds: 3.
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    37
                Transcript showCR:'One guy said: ', text
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    38
            ].
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    39
    text := 'Hello world'.
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    40
    job restart.
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    41
    Delay waitForSeconds: 5.
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    42
    text := 'Ahoj Svete!!'.
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    43
    job restart.
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    44
    Delay waitForSeconds: 1.
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    45
    text := 'Haya, I''m talking fast, you should not see the czech greeting'.
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    46
    job restart.
44d00fea6ee0 Added documentation and examples
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2590
diff changeset
    47
2590
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
    48
"
2574
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
! !
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
!BackgroundJob class methodsFor:'documentation'!
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
2590
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
    53
version
3493
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
    54
    ^ '$Header: /cvs/stx/stx/libbasic2/BackgroundJob.st,v 1.14 2015-02-21 10:03:13 vrany Exp $'
2590
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
    55
!
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
    56
2574
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
version_CVS
3493
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
    58
    ^ '$Header: /cvs/stx/stx/libbasic2/BackgroundJob.st,v 1.14 2015-02-21 10:03:13 vrany Exp $'
2574
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
!
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
version_SVN
3493
e7c920efe4cc Cleanup: introduced AbstractBackgroundJob, made all other jobs subclass of it.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2976
diff changeset
    62
    ^ '$Id: BackgroundJob.st,v 1.14 2015-02-21 10:03:13 vrany Exp $'
2574
0c9345fafac7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
! !
2976
e1da8a03d161 use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
    64