List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:August 13 2010 12:42pm
Subject:bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:3672)
View as plain text  
#At file:///home/msvensson/mysql/7.0-seagull/ based on revid:magnus.blaudd@stripped

 3672 Magnus Blåudd	2010-08-13
      ndb
       - Implement support for millisecond sleep directly in 'NdbSleep_MilliSleep',
        this avoids the need to convert back and forth to microseconds and avoids
        the need to include my_sys for this. The my_sys implementation also has a
        scary busy wait sleep if no select call is found which is now not implemented
        in NdbSleep

    modified:
      storage/ndb/include/portlib/NdbSleep.h
=== modified file 'storage/ndb/include/portlib/NdbSleep.h'
--- a/storage/ndb/include/portlib/NdbSleep.h	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/include/portlib/NdbSleep.h	2010-08-13 12:42:51 +0000
@@ -19,25 +19,27 @@
 #ifndef NDBSLEEP_H
 #define NDBSLEEP_H
 
-#ifdef	__cplusplus
-extern "C" {
-#endif
-
 #include <ndb_global.h>
-#include <my_sys.h>
 
-static inline void NdbSleep_MilliSleep(int milliseconds)
+static inline
+void NdbSleep_MilliSleep(int milliseconds)
 {
-  my_sleep(ulong(milliseconds)*1000UL);
+#ifdef _WIN32
+  Sleep(milliseconds);
+#elif defined(HAVE_SELECT)
+  struct timeval t;
+  t.tv_sec =  milliseconds / 1000L;
+  t.tv_usec = (milliseconds % 1000L) * 1000L;
+  select(0,0,0,0,&t);
+#else
+#error No suitable function found to implement millisecond sleep.
+#endif
 }
-static inline void NdbSleep_SecSleep(int seconds)
+
+static inline
+void NdbSleep_SecSleep(int seconds)
 {
   NdbSleep_MilliSleep(seconds*1000);
 }
 
-#ifdef	__cplusplus
-}
-#endif
-
-
 #endif

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20100813124251-j078h8318vlko311.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:3672) Magnus Blåudd13 Aug