Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

remove usleep #120

wants to merge 1 commit into from

Conversation

neheb
Copy link

@neheb neheb commented Oct 12, 2020

usleep is removed in POSIX 2008.

Signed-off-by: Rosen Penev rosenp@gmail.com

Copy link

@wsakernel wsakernel left a 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.

term.c Outdated Show resolved Hide resolved
@@ -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};

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?

Copy link
Author

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.

Copy link
Author

@neheb neheb Jun 29, 2022

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>
@wsakernel
Copy link

Merged as wsakernel@dbaa73d. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants