]> git.cworth.org Git - apitrace/blobdiff - common/os.hpp
glretrace: GLX and WGL support for ES2/EGL traces.
[apitrace] / common / os.hpp
index 91c819fca55f09a516a746d23283bd0ab81766de..741d345bf18b30d1c702a1770db3e245f7276611 100644 (file)
@@ -73,11 +73,29 @@ void log(const char *format, ...)
   #endif
 #endif
 
+/**
+ * Exit immediately.
+ *
+ * This should be called only from the wrappers, when there is no safe way of
+ * failing gracefully.
+ */
 void abort(void);
 
 void setExceptionCallback(void (*callback)(void));
 void resetExceptionCallback(void);
 
+/**
+ * Returns a pseudo-random integer in the range 0 to RAND_MAX.
+ */
+static inline int
+random(void) {
+#ifdef _WIN32
+    return ::rand();
+#else
+    return ::random();
+#endif
+}
+
 } /* namespace os */
 
 #endif /* _OS_HPP_ */