Browse Source

ENH: Add a delay method

Andy Cedilnik 21 years ago
parent
commit
320e90ef5a
2 changed files with 12 additions and 0 deletions
  1. 9 0
      Source/kwsys/SystemTools.cxx
  2. 3 0
      Source/kwsys/SystemTools.hxx.in

+ 9 - 0
Source/kwsys/SystemTools.cxx

@@ -2100,6 +2100,15 @@ kwsys_stl::string SystemTools::FileExistsInParentDirectories(const char* fname,
   return "";
   return "";
 }
 }
 
 
+void SystemTools::Delay(unsigned int msec)
+{
+#ifdef _WIN32
+  Sleep(msec);
+#else
+  usleep(msec * 1000);
+#endif
+}
+
 // These must NOT be initialized.  Default initialization to zero is
 // These must NOT be initialized.  Default initialization to zero is
 // necessary.
 // necessary.
 unsigned int SystemToolsManagerCount;
 unsigned int SystemToolsManagerCount;

+ 3 - 0
Source/kwsys/SystemTools.hxx.in

@@ -338,6 +338,9 @@ public:
   static kwsys_stl::string FileExistsInParentDirectories(const char* fname,
   static kwsys_stl::string FileExistsInParentDirectories(const char* fname,
     const char* directory, const char* toplevel);
     const char* directory, const char* toplevel);
 
 
+  /** Delay the execution for a specified amount of time specified in miliseconds */
+  static void Delay(unsigned int msec);
+
 protected:
 protected:
   // these two functions can be called from ConvertToOutputPath
   // these two functions can be called from ConvertToOutputPath
   /**
   /**