[PROBLEM] code generation & processes???

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Fri Mar 2 19:37:30 UTC 2001


On Fri, 2 Mar 2001, Elzbieta Chludzinska wrote:

> The following code fragment is inside of a loop which is forked as a
> Process.  It is part of a parallel simulation, in this case 2 images
> executing the models in the sim. When I execute the sim with this code
> in fails to #send:to:  the #NULL Event.
> 
> 
> lastNow = now
>    ifFalse: [self cOut
>       keysAndValuesDo: [:k :v | v ifFalse:
>          [Daemon singleInstance
>             send: (PackingData
>                        pack: (Event
>                                  time: now + self lookAhead  	   	   
>                            type: #NULL
>                                  from: self mid
>                                  to: k << 8 + 1))
>             to: k.
>          self nullMsgSent: self nullMsgSent + 1].
>       lastNow _ now]].
> 
> 
> If I change the above code to the following:
> 
> lastNow = now
>    ifFalse: [self cOut
>       keysAndValuesDo: [:k :v | v ifFalse:
>          [self nullMsgSent: self nullMsgSent + 1.
>          Daemon singleInstance
>             send: (PackingData
>                        pack: (Event
>                                  time: now + self lookAhead  	   	   
>                            type: #NULL
>                                  from: self mid
>                                  to: k << 8 + 1))
>             to: k
>          ].
>       lastNow _ now]].
> 
> the sim RUNS! ALL I've done is to move the single line:
> 
> self nullMsgSent: self nullMsgSent + 1.
> 
> from the beginning of the loop to the end of the loop.  nullMsgSent is
> just an instance variable used as a counter and plays NO role in the
> logic of the code.
> 
> Any ideas why?
> 
> Could this be a problem in the code generation?

Seems unlikely to me. 

> Could this be a problem with ProcessScheduler?

What does send:to: do? 

And what does it do when "it fails"? Is the send:to: called? You
double-checked it's just the line you move around?

-- Bert





More information about the Squeak-dev mailing list