BackgroundQueueProcessingJob.st
changeset 2707 b636f8f594e3
parent 2697 0090025b8aa7
child 2735 1960c3957377
--- a/BackgroundQueueProcessingJob.st	Fri Jan 20 18:26:27 2012 +0100
+++ b/BackgroundQueueProcessingJob.st	Fri Jan 20 18:27:22 2012 +0100
@@ -150,6 +150,17 @@
     "Modified: / 06-12-2011 / 15:50:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!BackgroundQueueProcessingJob methodsFor:'private'!
+
+setupThread: t priority: p
+    "Sets up worker thread"
+
+    super setupThread: t priority: p.
+    t addExitAction: [ queueProcessedSema signalForAll ].
+
+    "Created: / 20-01-2012 / 16:40:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !BackgroundQueueProcessingJob methodsFor:'processing'!
 
 process
@@ -167,11 +178,10 @@
         ].
         item ~~ cookie.
     ] whileTrue.
-    queueProcessedSema signalForAll.
 
     "Created: / 28-04-2011 / 20:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 03-08-2011 / 16:43:21 / cg"
-    "Modified: / 06-12-2011 / 15:50:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-01-2012 / 16:39:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 processItem: item
@@ -202,7 +212,7 @@
 
     | shouldWait |        
     queueAccessLock critical:[
-        shouldWait := queue isEmpty.
+        shouldWait := queue notEmpty.
     ].
     shouldWait ifTrue:[
         self start.
@@ -219,11 +229,11 @@
 !BackgroundQueueProcessingJob class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/BackgroundQueueProcessingJob.st,v 1.11 2011-12-13 14:16:02 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/BackgroundQueueProcessingJob.st,v 1.12 2012-01-20 17:27:22 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/BackgroundQueueProcessingJob.st,v 1.11 2011-12-13 14:16:02 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/BackgroundQueueProcessingJob.st,v 1.12 2012-01-20 17:27:22 vrany Exp $'
 !
 
 version_SVN