As Carl Worth identified, if the user passed the "-w" option to beable
to see the last frame of the retrace, the glretrace would enter a
busy-waiting loop, consuming as much CPU as possible.
#if defined(_WIN32)
-#include <windows.h>
-#elif defined(__linux__)
-#include <time.h>
-#elif defined(__APPLE__)
-#include <mach/mach_time.h>
+# include <windows.h>
#else
-#include <sys/time.h>
+# if defined(__linux__)
+# include <time.h>
+# elif defined(__APPLE__)
+# include <mach/mach_time.h>
+# else
+# include <sys/time.h>
+# endif
+# include <unistd.h>
#endif
#endif
}
+ // Suspend execution
+ inline void
+ sleep(unsigned long usecs) {
+#if defined(_WIN32)
+ Sleep((usecs + 999) / 1000);
+#else
+ usleep(usecs);
+#endif
+ }
} /* namespace os */
void
retrace::waitForInput(void) {
+ /* TODO */
}
void
void
retrace::waitForInput(void) {
while (glws::processEvents()) {
+ os::sleep(100*1000);
}
}