[PROBLEM] code generation & processes???

Elzbieta Chludzinska elzbieta at operamail.com
Fri Mar 2 19:25:30 UTC 2001


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?

Could this be a problem with ProcessScheduler?

Elzbieta





More information about the Squeak-dev mailing list