[CF-Devel] sleep_delta() doesn't work on windows

Mark Wedel mwedel at scruz.net
Tue Apr 17 23:11:30 CDT 2001


Andreas Vogl wrote:
>
     
     
     >
     
      The crossfire server compiles and runs under windows
     
     >
     
      without any trouble. Except for the fact that the sleep
     
     >
     
      doesn't work. As you can imagine, this makes the winserver
     
     >
     
      run at lightning speed.
     
     >
     
     
     >
     
      We should definitly try to fix that before V1.0.
     
     >
     
      It's the function sleep_delta() in "common/time.c".
     
     >
     
      If all else fails we could make an #ifdef and specify
     
     >
     
      a seperate sleep procedure for windows.
     
     
 Note that I don't develop on windows, or even use windows if I can at all help
it,  so don't look at me to fix it or any other windows related code.

 Note a simple fix may be to put in whatever window call you can use to sleep
for 120 ms and ignore the rest of the logic in sleep_delta.  You won't lose a
lot using that appproach.  all the logic in sleep_delta really does is try to
make sure that there are 120 ms (or whatever MAXTIME is defined to in config.h)
between ticks.  So if it took 20 ms to process everything last tick, then it
sleeps for 100 ms instead of 120.

 The cpu power of systems has increased faster than map complexity in crossfire,
so in most cases, most ticks only take a few ms.  The bigger hit is in loading
and saving maps.  My hope there is for 2.0 to make that operation threaded.  It
may very well happen that each map gets its own thread, so one slow map doesn't
slow things down for everyone else (except for the cpu time it is taking from
the system as a whole).  This should also make crossfire actually scale for
multi cpu systems.

    
    


More information about the crossfire mailing list