windows: Add a sleep function acting as cancellation point
authorMartin Willi <martin@revosec.ch>
Mon, 21 Oct 2013 14:58:54 +0000 (16:58 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Jun 2014 13:53:01 +0000 (15:53 +0200)
src/libstrongswan/utils/windows.h

index 83a6d62..afa5242 100644 (file)
@@ -77,6 +77,15 @@ static inline int sched_yield(void)
 }
 
 /**
+ * Replacement of sleep(3), cancellable by thread_cancel()
+ */
+static inline int sleep(unsigned int seconds)
+{
+       SleepEx(seconds * 1000, TRUE);
+       return 0;
+}
+
+/**
  * strdup(3), the Windows variant can't free(strdup("")) and others
  */
 #define strdup strdup_windows