Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CF: Why is this line in readable.c, line 1357?



> On Jan 19, 10:03pm, James Cameron wrote:
> > Subject: Re: CF: Why is this line in readable.c, line 1357?
> > Peter Mardahl wrote:
> > > while (al == NULL);
> >
> > Code in context, 0.93.7 ...
> 
>  Its actually the same in 0.95.1
> 
>  However, there should probably be a retry count added, so we only do that lo
>op
> so many times before giving up.

Oddly, I was confused about the line because it was on its own line.
I thought it was just:

"while (al==NULL);"

equivalent to:
  while (al==NULL) {};

  Which I thought was strange.  On my dual-CPU 2.0.36 Linux machine,
this endless loop couldn't be stopped with a kill, kill -15, kill -9.
But oddly, the hung program would halt immediately when I reniced it.
SMP linux can be weird sometimes.

  The problem arose because I had needed to call init_readables and
init_artifacts in the standalone random map generator.  (The server
has all these data structures around.)

  But endlessly looping isn't optimal behavior....

PeterM




> >
> >   /* lets determine what kind of artifact type randomly.
> >    * Right now legal artifacts only come from those listed
> >    * in art_name_array. Also, we check to be sure an artifactlist
> >    * for that type exists!
> >    */
> >   do {
> >      index = RANDOM()%(sizeof(art_name_array)/sizeof(arttypename));
> >      type=art_name_array[index].type;
> >      al = find_artifactlist(type);
> >   } while(al==NULL);
> >
> > --
> > James Cameron                                      (cameron@stl.dec.com)
> >
> > OpenVMS, Linux, Firewalls, Software Engineering, CGI, HTTP, X, C, FORTH,
> > COBOL, BASIC, DCL, csh, bash, ksh, sh, Electronics, Microcontrollers,
> > Disability Engineering, Netrek, Bicycles, Pedant, Farming, Home Control,
> > Remote Area Power, Greek Scholar, Tenor Vocalist, Church Sound, Husband.
> >
> > "Specialisation is for insects." -- Robert Heinlein.
> > -
> > [you can put yourself on the announcement list only or unsubscribe altogeth
>er
> > by sending an email stating your wishes to crossfire-request@ifi.uio.no]
> >-- End of excerpt from James Cameron
> 
> 
> 
> -- 
> 
> -- Mark Wedel
> mark@pyramid.com
> -
> [you can put yourself on the announcement list only or unsubscribe altogether
> by sending an email stating your wishes to crossfire-request@ifi.uio.no]
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to crossfire-request@ifi.uio.no]