|
Class: AbstractBackgroundJob
Object
|
+--AbstractBackgroundJob
|
+--BackgroundJob
|
+--BackgroundPeriodicalJob
|
+--BackgroundQueueProcessingJob
- Package:
- stx:libbasic2
- Category:
- System-Support-JobQueue
- Version:
- rev:
1.10
date: 2024/04/18 14:21:57
- user: cg
- file: AbstractBackgroundJob.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
Ab AbstractBackgroundJob is a base superclass for any kind of background
processing job. Possible uses include (but not limited to):
copying files, syntax higlighting, live searching, autosave, etc.
See subclasses for various form of background processing.
A task to be processed in a background is given to instances
in a form of a block or a message send. The background task must
be then started by sending a #start message to the instance of
the job. A job may be restarted any time by sending #restart or
terminated by sending #stop. Sending #start to already started
job does nothing.
Implementation note:
The the task is actually processed in a separate, exclusive
worker thread, so an explicit synchronization has to
be done iff the task accesses possibly shared data.
The worker exists only iff the job is actually running. When
the task is finished, the worker thread terminates.
[instance variables:]
name <String|nil> A user friendly name of a job,
useful for identifing job's thread in
process list.
job <Block|MessageSend> A task to perform in background.
priority<Integer> A priority of worker thread. Defaults to
Processor userBackgroundPriority.
thread <Process|nil> The worker thread
running <Boolean> Boolean value indicating whether
tasks already started or not.
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.
instance creation
-
named: name
-
-
named: name on: block
-
-
new
-
return an initialized instance
-
on: block
-
queries
-
isAbstract
-
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.
accessing
-
initiatingThread
-
-
initiatingThread: something
-
-
isDebuggerJob
-
-
isDebuggerJob: aBoolean
-
added to allow suppression of breakpoints/halts of a
job started by the debugger
(if you ask what this is for,
try to put a breakpoint into the syntaxhighlighter in the old schema)
-
job
-
-
job: aBlockOrMessageSend
-
Sets the job to be done. The job is sent
#value from the worker thread once started
-
name
-
-
name: aString
-
-
priority
-
-
priority: anInteger
-
Set the priority of a worker thread
-
thread
-
Return the thread (an instance of Process) that currently
processes the job or nil. if no processing is currently performed.
initialization
-
initialize
-
super initialize. -- commented since inherited method does nothing
private
-
setupThread: t priority: p
-
Sets up worker thread
processing
-
process
-
Actually perform the job. This method is called from the background worker thread
** This method must be redefined in concrete classes (subclassResponsibility) **
queries
-
running
-
Return true if the job is actually running, i.e., if it
is actually computing a value, contrary to #scheduled, that
returns true even if computation actually did not start
(i.e., thread is created but was not scheduled so far)
-
scheduled
-
Return true, if the job has been already started
start & stop
-
abort
-
Abort the job, if it is running. Similar to #stop, but raises
abort operation request so the job has a chance to terminate
gracefully
-
restart
-
-
start
-
-
startWithPriority: prio
-
-
startWithPriorityRange: prioRange
-
-
stop
-
raise its prio to make it terminate quickly
|