summaryrefslogtreecommitdiff
path: root/lib/system.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system.h')
-rw-r--r--lib/system.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/system.h b/lib/system.h
index b1f556557a..849090ee3a 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -4,7 +4,9 @@
#include <gnutls_int.h>
#ifndef _WIN32
-#include <sys/uio.h> /* for writev */
+# include <sys/uio.h> /* for writev */
+#else
+# include <windows.h> /* for Sleep */
#endif
int system_errno (gnutls_transport_ptr_t);
@@ -35,4 +37,17 @@ ssize_t system_read_peek (gnutls_transport_ptr_t ptr, void *data,
int _gnutls_atfork (void (*prepare) (void), void (*parent) (void),
void (*child) (void));
+static inline void millisleep(unsigned int ms)
+{
+#ifdef _WIN32
+ Sleep(ms);
+#else
+struct timespec ts;
+ ts.tv_sec = 0;
+ ts.tv_nsec = ms*1000*1000;
+
+ nanosleep(&ts, NULL);
+#endif
+}
+
#endif /* SYSTEM_H */