Skip to content

Commit

Permalink
util: xleep for Windows.
Browse files Browse the repository at this point in the history
Windows does not have a sleep(seconds). But it does have
a Sleep(milliseconds). Sleep() in windows does not have a
return value. Since we are not using the return value for xsleep()
anywhere as of now, don't return any.

Introduced by commit 275eebb (utils: Introduce xsleep for RCU quiescent state)

CC: Pravin B Shelar <[email protected]>
Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
  • Loading branch information
shettyg committed Mar 31, 2014
1 parent 437d0d2 commit 5fd2f41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions lib/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1727,15 +1727,16 @@ ovs_scan(const char *s, const char *format, ...)
return ok;
}

unsigned int
void
xsleep(unsigned int seconds)
{
unsigned int t;

ovsrcu_quiesce_start();
t = sleep(seconds);
#ifdef _WIN32
Sleep(seconds * 1000);
#else
sleep(seconds);
#endif
ovsrcu_quiesce_end();
return t;
}

#ifdef _WIN32
Expand Down
2 changes: 1 addition & 1 deletion lib/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,13 +502,13 @@ void bitwise_put(uint64_t value,
uint64_t bitwise_get(const void *src, unsigned int src_len,
unsigned int src_ofs, unsigned int n_bits);

void xsleep(unsigned int seconds);
#ifdef _WIN32

char *ovs_format_message(int error);
char *ovs_lasterror_to_string(void);
int ftruncate(int fd, off_t length);
#endif
unsigned int xsleep(unsigned int seconds);

#ifdef __cplusplus
}
Expand Down

0 comments on commit 5fd2f41

Please sign in to comment.