-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove usleep #120
base: master
Are you sure you want to change the base?
remove usleep #120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I think switching to nanosleep is good, I have two comments, however.
@@ -1666,7 +1673,10 @@ term_fake_flush(int fd) | |||
break; | |||
} | |||
/* see comment in term_drain */ | |||
if ( DRAIN_DELAY ) usleep(DRAIN_DELAY); | |||
if ( DRAIN_DELAY ) { | |||
struct timespec d = {0, DRAIN_DELAY * 1000}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it enough to have one timespec d for all invocations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are only two. I'd also rather not have a global.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could also rewrite to use a compound literal. Requires C11 or GNU extensions.
usleep is removed in POSIX 2008. Signed-off-by: Rosen Penev <rosenp@gmail.com>
Merged as wsakernel@dbaa73d. Thank you! |
usleep is removed in POSIX 2008.
Signed-off-by: Rosen Penev rosenp@gmail.com