From 09cc0ee7bebcdde9f5a40e827a9e29f9ae7fdf11 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 20 Jun 2007 11:16:42 +0000 Subject: [w32] gpg-agent is now started automagically by gpgsm. --- common/sysutils.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'common/sysutils.c') diff --git a/common/sysutils.c b/common/sysutils.c index d044f222b..ff1fe1ba4 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -20,23 +20,36 @@ */ #include + +#ifdef WITHOUT_GNU_PTH /* Give the Makefile a chance to build without Pth. */ +# undef HAVE_PTH +# undef USE_GNU_PTH +#endif + #include #include #include #include #include #ifdef HAVE_STAT -#include +# include #endif #if defined(__linux__) && defined(__alpha__) && __GLIBC__ < 2 - #include - #include +# include +# include #endif #ifdef HAVE_SETRLIMIT - #include - #include - #include +# include +# include +# include +#endif +#ifdef HAVE_W32_SYSTEM +# include +#endif +#ifdef HAVE_PTH +# include #endif + #include "util.h" #include "i18n.h" @@ -229,3 +242,33 @@ check_permissions(const char *path,int extension,int checkonly) return 0; } #endif + + +/* Wrapper around the usual sleep fucntion. This one won't wake up + before the sleep time has really elapsed. When build with Pth it + merely calls pth_sleep and thus suspends only the current + thread. */ +void +gnupg_sleep (unsigned int seconds) +{ +#ifdef HAVE_PTH + /* With Pth we force a regular sleep for seconds == 0 so that also + the process will give up its timeslot. */ + if (!seconds) + { +# ifdef HAVE_W32_SYSTEM + Sleep (0); +# else + sleep (0); +# endif + } + pth_sleep (seconds); +#else + /* Fixme: make sure that a sleep won't wake up to early. */ +# ifdef HAVE_W32_SYSTEM + Sleep (seconds*1000); +# else + sleep (seconds); +# endif +#endif +} -- cgit v1.2.3