diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index b883e2911e..a4176f80bf 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,9 @@ +2010-12-12 Vincent Torri + + * src/lib/evil_unistd.c: + * src/lib/evil_unistd.h: + add usleep() for vc++ + 2010-12-10 Vincent Torri reviewed by: Vincent Torri diff --git a/legacy/evil/src/lib/evil_unistd.c b/legacy/evil/src/lib/evil_unistd.c index 897c86abab..dce441ce28 100644 --- a/legacy/evil/src/lib/evil_unistd.c +++ b/legacy/evil/src/lib/evil_unistd.c @@ -78,6 +78,15 @@ evil_gettimeofday(struct timeval *tp, void *tzp __UNUSED__) return 1; } +#ifdef _MSC_VER +int +evil_usleep(unsigned long usec) +{ + Sleep(usec / 1000); + return 0; +} +#endif + /* * Process identifer related functions diff --git a/legacy/evil/src/lib/evil_unistd.h b/legacy/evil/src/lib/evil_unistd.h index cdb4c3122b..b9ad67e8a6 100644 --- a/legacy/evil/src/lib/evil_unistd.h +++ b/legacy/evil/src/lib/evil_unistd.h @@ -62,6 +62,32 @@ EAPI int evil_gettimeofday(struct timeval * tp, void * tzp); */ #define gettimeofday(tp,tzp) evil_gettimeofday((tp),(tzp)) +#ifdef _MSC_VER + +/** + * @brief Suspend the execution of the calling process for microsecond + * intervals. + * + * @param usec The interval in microseconds. + * @return Always 0 (success). + * + * This function suspends the execution of the calling process for (at + * least) @p usec microseconds. + * + * Conformity: Not appliclable. + * + * Supported OS: Windows XP, Windows CE. + */ +EAPI int evil_usleep(unsigned long usec); + +/** + * @def usleep(usec) + * + * Wrapper around evil_usleep(). + */ +#define usleep(usec) evil_usleep(usec); + +#endif /* _MSC_VER */ /* * Process identifer related functions