#FEATURE
class: BackgroundQueueProcessingJob
comment/format in: #add:at:
changed: #process
it seems that nil might be a valid entry.
--- 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>"