#FEATURE
authorClaus Gittinger <cg@exept.de>
Tue, 19 Jan 2016 14:15:06 +0100
changeset 3707 473883f651d6
parent 3704 f19ba96f7722
child 3708 f06a35deef7f
#FEATURE class: BackgroundQueueProcessingJob comment/format in: #add:at: changed: #process it seems that nil might be a valid entry.
BackgroundQueueProcessingJob.st
--- a/BackgroundQueueProcessingJob.st	Mon Jan 18 20:19:57 2016 +0100
+++ b/BackgroundQueueProcessingJob.st	Tue Jan 19 14:15:06 2016 +0100
@@ -140,8 +140,6 @@
 !
 
 add: object at: index
-    "includes: is not synchronized, but should not harm"
-
     queueAccessLock critical:[
         (queue includes: object) ifFalse:[
             index notNil ifTrue:[
@@ -185,14 +183,18 @@
 
 process
     [
-        | item |
+        |hasMore item |
 
-        item := nil.
+        hasMore := false.
         queueAccessLock critical:[
-            queue notEmpty ifTrue:[item := queue removeFirst]
+            queue notEmpty ifTrue:[
+                hasMore := true.
+                item := queue removeFirst
+            ]
         ].
-        item isNil ifTrue:[^ self].
+        hasMore ifFalse:[^ self].
         self processItem: item.
+        item := nil.
     ] loop.
 
     "Created: / 28-04-2011 / 20:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"