swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ordering events in a swarm ....


From: Ken Cline
Subject: Re: ordering events in a swarm ....
Date: Sun, 6 Jun 1999 21:53:37 -0400 (EDT)

Xueyue,     

Could you clarify a few things...

 > -buildActions {
 >   ...
 > [schedulerSwarm buildActions];
 >   ...
 > }
 > -activateIn: context {
 >   ...
 > [schedulerSwarm buildActions];
 >   ...
 > }

Is this right?  Are you calling `buildActions' twice?


 > [schedulerSwarm newScheduleAt: (timeval_t) t target: (id)tg
 >                                             message: (SEL) msg];

What does the `newScheduleAt:target:message:' method look
like?  This seems to be the method you think is not working
correctly and it would be easier to understand what's
happening if you posted that part of the source code, as
well.


 > in the observerSwarm, I have a test method:
 > -test {
 >  printf("I am testing schedulerSwarm ....\n");
 > return self;
 > }

I gather from the rest of of your message that the `test'
method is actually in the `schedulerSwarm' and not in the
`observerSwarm', is that correct?


 > and a method -step which is scheduled to be called at 
 > at every step:
 > 
 > -step {
 >  timeval_t tm [timeSwarm getTime];
 >  int x = 5;
 >  tm=tm+x;
 >  [schedulerSwarm newScheduleAt: tm target: self message: M(test)];
 > return self;
 > }

This `step' method shouldn't compile since you are missing a
`=' on the first line.  I presume that otherwise this
matches your source code exactly, right?


 > here timeSwarm is another swarm, which serves as a clock, 
 > and -getTime will get current time.

To simplify the problem, you could replace the `[timeSwarm
getTime]' call with the macro `getCurrentTime()'.  I do not
think that will fix your problem, since you've probably
already tested that `getTime' returns the correct value.  I
only suggest using `getCurrentTime()' so others can 
duplicate the problem; alternatively you could post the
code to `getTime'.


 > x is an integer produced by uniformIntRand. (there is 
 > <random.h>, x is corretly produced ---can be tested 
 > by printf("x is %d ...", x)), ...

Be sure to check the `tm' value since it is the one used to
schedule the action(s).


 > however, the programme will no longer work!

What do you mean? Does it compile? If it compiles then what
errors do you get?  Have you run it in a debugger? What does
the backtrace look like?  (The more information you can
provide the easier it'll be to find the problem.)

Also, it would be good to know which version of swarm you
are using.


Ken.

_________________________________________________________
Ken Cline                             address@hidden
SAIC                                 VOICE (410) 571-0413
Annapolis, MD                          FAX (301) 261-8427



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]