|
Class: BackgroundJob
Object
|
+--AbstractBackgroundJob
|
+--BackgroundJob
- Package:
- stx:libbasic2
- Category:
- System-Support-JobQueue
- Version:
- rev:
1.17
date: 2021/04/09 14:37:40
- user: cg
- file: BackgroundJob.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
A BackgroundJob for one-shot computation. When started, it performs it job
and terminates. User have to explicitly ask job to start again to
perform new computation.
[instance variables:]
[class variables:]
copyrightCOPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
All Rights Reserved
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
processing
-
process
-
Actually perform the job. This method is called from the background worker thread
-
process: aBlock
-
start & stop
-
restart: aBlock
-
Restart the job, evaluationg aBlock instead of pre-configured job
-
start: aBlock
-
Start the job, evaluating aBlock instead of pre-configured `job`.
-
start: block withPriority: prio
-
| job text |
job := BackgroundJob named: 'example job' on:[
Delay waitForSeconds: 3.
Transcript showCR:'One guy said: ', text
].
text := 'Hello world'.
job restart.
Delay waitForSeconds: 5.
text := 'Ahoj Svete!'.
job restart.
Delay waitForSeconds: 1.
text := 'Haya, I''m talking fast, you should not see the czech greeting'.
job restart.
|