diff options
author | Gerald Carter <jerry@samba.org> | 2005-01-21 18:47:55 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2005-01-21 18:47:55 +0000 |
commit | 0ff19b2807e92b9abd3fc8cd716dd19284e93af9 (patch) | |
tree | 2f2b58e05c853b1a47f2d73e398da1cbd22fc8fc /source/lib/util.c | |
parent | f1f54e8731e7cf45a849d3c7bd6d7eee6f9b33b7 (diff) | |
download | samba-0ff19b2807e92b9abd3fc8cd716dd19284e93af9.tar.gz samba-0ff19b2807e92b9abd3fc8cd716dd19284e93af9.tar.xz samba-0ff19b2807e92b9abd3fc8cd716dd19284e93af9.zip |
r4904: sync up with 3.0 for 3.0.11pre2
Diffstat (limited to 'source/lib/util.c')
-rw-r--r-- | source/lib/util.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/lib/util.c b/source/lib/util.c index 4d66ed96558..455f87aaab8 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -779,12 +779,24 @@ SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n) void smb_msleep(unsigned int t) { +#if defined(HAVE_NANOSLEEP) + struct timespec tval; + int ret; + + tval.tv_sec = t/1000; + tval.tv_nsec = 1000000*(t%1000); + + do { + errno = 0; + ret = nanosleep(&tval, &tval); + } while (ret < 0 && errno == EINTR && (tval.tv_sec > 0 || tval.tv_nsec > 0)); +#else unsigned int tdiff=0; struct timeval tval,t1,t2; fd_set fds; GetTimeOfDay(&t1); - GetTimeOfDay(&t2); + t2 = t1; while (tdiff < t) { tval.tv_sec = (t-tdiff)/1000; @@ -808,6 +820,7 @@ void smb_msleep(unsigned int t) tdiff = TvalDiff(&t1,&t2); } +#endif } /**************************************************************************** |