#BUGFIX by stefan
class: OperationQueue
changed:
#fetchNextOperationAndExecute (send #signal instead of #signalForAll)
#scheduleOperation:asynchronous:
Fix race beteween signal(ForAll) and wait.
--- a/OperationQueue.st Wed May 08 14:41:45 2019 +0200
+++ b/OperationQueue.st Thu May 16 14:54:03 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2000 by eXept Software AG
All Rights Reserved
@@ -160,13 +162,15 @@
].
opInQ operationResult:rslt.
- opInQ operationPerformedSema signalForAll.
+ opInQ operationPerformedSema signal.
[
queue isEmpty ifTrue:[
self stopConsumerProcess
]
] valueUninterruptably
+
+ "Modified: / 16-05-2019 / 14:52:55 / Stefan Vogel"
!
startConsumerProcess
@@ -261,7 +265,8 @@
"/ if not, create a new one and enqueue
myOpInQ isNil ifTrue:[
myOpInQ := OperationInQueue new.
- myOpInQ operationPerformedSema:(Semaphore new).
+ "/ use an EventSemaphore to protect against races between signal and wait
+ myOpInQ operationPerformedSema:(EventSemaphore new).
myOpInQ operation:anotherOperation.
[
queue nextPut:myOpInQ.
@@ -290,6 +295,7 @@
^ myOpInQ operationResult
"Modified (format): / 22-05-2017 / 12:08:05 / mawalch"
+ "Modified: / 16-05-2019 / 14:51:57 / Stefan Vogel"
! !
!OperationQueue methodsFor:'queries'!