From 986a577097f8aeb5b5dda16a5c148e3fa02aba4a Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Mon, 21 Oct 2013 16:58:54 +0200 Subject: [PATCH] windows: Add a sleep function acting as cancellation point --- src/libstrongswan/utils/windows.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libstrongswan/utils/windows.h b/src/libstrongswan/utils/windows.h index 83a6d6253..afa524242 100644 --- a/src/libstrongswan/utils/windows.h +++ b/src/libstrongswan/utils/windows.h @@ -76,6 +76,15 @@ static inline int sched_yield(void) return 0; } +/** + * 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 */