aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-04-06 18:44:58 +0000
committerNicola Mettifogo2007-04-06 18:44:58 +0000
commit700fba21ed42e92fd61ec18bc146df6d5eefb2b2 (patch)
tree24059679b07974c2628f9af786af283c566b5b43 /engines/parallaction
parentdca464b06e77c8cd26c14d421f8f1f1a2f6cadda (diff)
downloadscummvm-rg350-700fba21ed42e92fd61ec18bc146df6d5eefb2b2.tar.gz
scummvm-rg350-700fba21ed42e92fd61ec18bc146df6d5eefb2b2.tar.bz2
scummvm-rg350-700fba21ed42e92fd61ec18bc146df6d5eefb2b2.zip
Enabled lazy removal for Job instances.
svn-id: r26396
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/parallaction.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index c8f2447039..9bda9583da 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -872,9 +872,7 @@ Job *Parallaction::addJob(JobFn fn, void *parm, uint16 tag) {
}
void Parallaction::removeJob(Job *j) {
-
- removeNode(j);
- delete j;
+ j->_finished = 1;
return;
}
@@ -896,11 +894,14 @@ void Parallaction::runJobs() {
while (j) {
debugC(3, kDebugJobs, "runJobs: %i", j->_tag);
- (*j->_fn)(j->_parm, j);
Job *v4 = (Job*)j->_next;
- if (j->_finished == 1)
- removeJob(j);
+ if (j->_finished == 1) {
+ removeNode(j);
+ delete j;
+ } else {
+ (*j->_fn)(j->_parm, j);
+ }
j = v4;
}