Re: [CODE] Tick counter

From: Daniel A. Koepke (dkoepke@california.com)
Date: 04/14/99


On Wed, 14 Apr 1999, Anthony Benjamin wrote:

> do{
> dreams junk
> }while(originialHP < GETHIT(ch))

Which wouldn't be a good idea since CircleMUD is a non-threaded,
multiplexing, asynchronous server.  In other words: nothing would be done
until the function terminates.  If I do,

  while (1) {
    ... connection and timing handling
    some_function(tick);
    tick++;
  }

  void some_function(int tick)
  {
    while (!(tick % SOME_VAL)) {
      ...
    }
  }

assuming the internal loop of some_function() doesn't alter tick, we have
an infinite loop.  If some_function() does alter the value of tick, then
we have poor programming and what would be perceived as lag by other
connections to the game while some_function() does whatever it needs to
do, which means CircleMUD would be completely unresponsive until such time
as some_function() returns -- which may be nearly instantaneous, as all of
CircleMUD's functions are; several seconds; several minutes; several
hours.  Whatever.  It's *NOT* a good idea.

-dak


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST