mirror of
https://github.com/fluencelabs/redis
synced 2025-03-23 11:00:50 +00:00
use nanosleep instead of usleep
SUSv3 says that: The useconds argument shall be less than one million. If the value of useconds is 0, then the call has no effect. and actually NetBSD's implementation rejects such a value with EINVAL. use nanosleep which has no such a limitation instead.
This commit is contained in:
parent
b2dd0849ce
commit
ae82867664
@ -329,8 +329,11 @@ void debugCommand(redisClient *c) {
|
||||
} else if (!strcasecmp(c->argv[1]->ptr,"sleep") && c->argc == 3) {
|
||||
double dtime = strtod(c->argv[2]->ptr,NULL);
|
||||
long long utime = dtime*1000000;
|
||||
struct timespec tv;
|
||||
|
||||
usleep(utime);
|
||||
tv.tv_sec = utime / 1000000;
|
||||
tv.tv_nsec = (utime % 1000000) * 1000;
|
||||
nanosleep(&tv, NULL);
|
||||
addReply(c,shared.ok);
|
||||
} else if (!strcasecmp(c->argv[1]->ptr,"set-active-expire") &&
|
||||
c->argc == 3)
|
||||
|
Loading…
x
Reference in New Issue
Block a user