Changeset 3bb2203 in tol


Ignore:
Timestamp:
May 25, 2010, 2:49:20 PM (16 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
d74c90b
Parents:
26bc2dd
Message:

New method BSys::SleepMilliSeconds

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@2197 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • tol/bbasic/sys.cpp

    r26bc2dd r3bb2203  
    980980}
    981981
     982
     983//--------------------------------------------------------------------
     984//Make inactive waiting until they have passed a given number of milliseconds
     985void BSys::SleepMilliSeconds(unsigned int milliseconds)
     986//--------------------------------------------------------------------
     987{
     988#ifdef _MSC_VER
     989  Sleep(milliseconds);
     990#else
     991  usleep(milliseconds*1000);
     992#endif
     993}
     994
     995//--------------------------------------------------------------------
     996//Opens a file and locks it
     997//If cannot do it then sleeps and retries again until time is out
     998FILE* FOpenAndLock(
     999   const char *filename,
     1000   const char *mode,
     1001   unsigned int timeOutInMilliseconds,
     1002   char* errorMessage)
     1003//--------------------------------------------------------------------
     1004{
     1005  FILE* fil=NULL;
     1006  return(fil);
     1007}
     1008
     1009//--------------------------------------------------------------------
     1010//Unlocks a file and close it
     1011i FUnlockAndClose(FILE* file)
     1012//--------------------------------------------------------------------
     1013{
     1014  FILE* fil=NULL;
     1015  return(fil);
     1016}
  • tol/bbasic/tol_bsys.h

    r26bc2dd r3bb2203  
    157157  static double SessionTime();
    158158  static const BDate& SessionInitTime();
    159 
     159  //Make inactive waiting until they have passed a given number of milliseconds
     160  static void SleepMilliSeconds(unsigned int milliseconds);
     161  //Opens a file and locks it
     162  //If cannot do it then sleeps and retries again until time is out
     163  static FILE* FOpenAndLock(
     164   const char *filename,
     165   const char *mode,
     166   unsigned int timeOutInMilliseconds=0,
     167   char* errorMessage=NULL);
     168  //Unlocks a file and close it
     169  static void FUnlockAndClose(FILE* file);
    160170};
    161171
  • tol/btol/bgrammar/oprimp.cpp

    r26bc2dd r3bb2203  
    309309              I2(" (trying again after 10 seconds)",
    310310                 " (reintentando tras 10 segundos)"));
    311         #ifdef _MSC_VER
    312         Sleep(10000);
    313         #else
    314         sleep(10);
    315         #endif
     311        BSys::SleepMilliSeconds(10000);
    316312        dump = fopen(path,"w");
    317313      }
  • tol/btol/real_type/datgrav.cpp

    r26bc2dd r3bb2203  
    20612061  I2("(Real seconds)",
    20622062     "(Real segundos)"),
    2063   I2("Sleeps TOL process while the specified time.",
     2063  I2("Sleeps TOL process while the specified time. Minimum unit is "
     2064     "millsecond, I.E. 0.001 seconds ",
    20642065     "El proceso TOL se queda en estado de espera no activa durante el "
    2065      "tiempo especificado. El proceso no consumirá CPU en este periodo."),
     2066     "tiempo especificado. El proceso no consumirá CPU en este periodo. "
     2067     "La unidad mínima de tiempo es el milisegundo, o sea, 0.001 "
     2068     "segundos"),
    20662069     BOperClassify::Conversion_);
    20672070  void BDatSleep::CalcContens()
    … …  
    20692072{
    20702073  contens_ = Dat(Arg(1));
    2071 #ifdef _MSC_VER
    2072   Sleep((BInt)contens_.Value()*1000);
    2073 #else
    2074   sleep((BInt)contens_.Value());
    2075 #endif
     2074  BSys::SleepMilliSeconds((BInt)contens_.Value()*1000);
    20762075}
    20772076
Note: See TracChangeset for help on using the changeset viewer.