we are working on an application using WebServices, SciSockets, PlatformFunctions, etc - all the "nice stuff". Sometimes we encounter various problems with the asynchronous future calls (Usually raceconditions during shutdown). To fix these issues (sure helps that everything is in Smalltalk...), we changed the following coding in VA.
BTW - we are still using 7.0.1 in the project.
- Code: Select all
!AcoCoroutineFuture privateMethods !
"Put the resource group back in the resource pool"
| fStub |
resourceGroup := nil.
(fStub := self futureStub) isNil ifFalse: [
resourceManager addGroup: fStub resourceGroup.
].! !"Extended Edition of PlatformFunction"!
!PlatformFunction privateMethods !
asyncCallWithFuture: future originalObjects: anArray
"Answer the future object. The future object must have already allocated the resources. Copy the
parameters to the asyncblock before the call"
future asyncBlock isNil ifTrue: [
"TS - prevent a primitive failed because the block may be nil during shutdown"
self primitiveAsyncCallSetUp: anArray asyncBlock: future asyncBlock inFuture: future.
future thread startExecution.
!AcoFuture privateMethods !
"Signal that thread has completed execution. Allow processes waiting on the
value to retreive it"
self futureStub isNil ifTrue: [
^ AcoError new errorCode: ACORESOURCESLOST
^self futureStub errorValue isNil
ifTrue: [returnValue := self primitiveCopyAsyncParametersBack: self asyncBlock]
returnValue := AcoError new errorCode: ACOEXCEPTIONHAPPENED.
returnValue getGpInfoString: self thread.
self futureStub errorValue: nil]! !
!AcoFutureStub privateMethods !
"This method is called when the asynchronous call completes"
directedMessage receiver isNil ifTrue: [
"The receiver has been removed. Might happen during race conditions"
^directedMessage send! !