Solved: WAProcess>>critical:ifError problem

This is a discussion on Solved: WAProcess>>critical:ifError problem within the Smalltalk forums in Programming Languages category; Hi there, in reference to http://groups.google.com/group/comp....f04d0252c5142b and after two days of pain I've finally found a solution for that problem: making the response an instVar so the continuation wont overwrite the result as nil. I have not found final evidence but all I've seen indicates that continuations in Squeak and VisualWorks have some sort of compensation effect for temps which Dolphin has not. So they wont overwrite the temp which receives the answer of the block evaluation with nil as Dolphin does. The code I'm using now is WAProcessMonitor>>critical: aBlock ifError: anErrorBlock ^ mutex critical:[ semaphore := SeasidePlatformSupport semaphoreClass new. ...

Go Back   Application Development Forum > Programming Languages > Smalltalk

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-22-2008, 04:47 PM
Sebastian
Guest
 
Default Solved: WAProcess>>critical:ifError problem

Hi there,

in reference to

http://groups.google.com/group/comp....f04d0252c5142b

and after two days of pain I've finally found a solution for that
problem: making the response an instVar so the continuation wont
overwrite the result as nil.

I have not found final evidence but all I've seen indicates that
continuations in Squeak and VisualWorks have some sort of compensation
effect for temps which Dolphin has not. So they wont overwrite the
temp which receives the answer of the block evaluation with nil as
Dolphin does.

The code I'm using now is

WAProcessMonitor>>critical: aBlock ifError: anErrorBlock
^ mutex critical:[
semaphore := SeasidePlatformSupport semaphoreClass new.
process := [[response := aBlock on: Error do: anErrorBlock]
ensure: [semaphore signal]] fork.
semaphore wait.
process := nil.
response].

For the record the previous was:

| value |

mutex critical:
[process := Processor activeProcess.
[value := aBlock on: Error do: anErrorBlock] ensure: [process :=
nil]
].
^ value

which is a workaround which uses more than 400% of additional RAM
unnecessarily (because the continuation will copy the process to its
born far there in swazoo). That fork is cutting the copy just where it
is needed (a pity those subtleties aren't documented).

I hope this is one problem less for Dolphin Seasiders,

Cheers,

Sebastian

Reply With Quote
  #2  
Old 08-26-2008, 10:16 PM
Malbs
Guest
 
Default Re: Solved: WAProcess>>critical:ifError problem

Nice find/fix!


Reply With Quote
  #3  
Old 08-27-2008, 08:36 AM
Sebastian
Guest
 
Default Re: Solved: WAProcess>>critical:ifError problem

On Aug 26, 11:16*pm, "Malbs" <ssefl...@somewhere.com> wrote:
> Nice find/fix!


Subject magic

Also check:

http://groups.google.com/group/comp....aaebf80?hl=en#

cheers,

Sebastian
Reply With Quote
  #4  
Old 08-28-2008, 03:50 PM
macta
Guest
 
Default Re: Solved: WAProcess>>critical:ifError problem

Sebastian <ssastre@seaswork.com.ar> wrote:

> and after two days of pain I've finally found a solution for that
> problem: making the response an instVar so the continuation
> wontoverwrite the result as nil.


Any chance you could put your Seaside corrections into the global repository that David has now provided?

We need to get better at having a global place with all latest fixes (I'm equally guilty as well)

Tim
--
I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 09:06 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.