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

some minor fd/socket cleanups and make logging thread safe #7123

Merged
merged 5 commits into from
Jul 31, 2024

Conversation

gulafaran
Copy link
Contributor

the logger change is something i kinda made apparent on my own by placing various Debug::log() in places to figure things out and suddenly i hit bad things, so make it thread safe and only open file once on start and close it on exit.

the rest is a few fd/socket leaks and closing already closed or closing -1 fd's making valgrind a bit spammy.

also change the way bezier loops over getYForPoint,

looping a float and incrementing it can cause subtle precision errors like looping 8 times or 10 times depending on how it turns out. god willing it does it right. so loop 9 iterations and get the float value from that instead

Using a floating-point loop variable with a fixed increment can cause precision
errors over time due to the nature of floating-point arithmetic.
and cause undesired effects.

ex
iteration 1 = 0.10000000149011611938
iteration 2 = 0.20000000298023223877

eventually..

iteration 8 = 0.80000001192092895508
iteration 9 = 0.89999997615814208984
store socketpath and close the fd and unlink the socket path on exit.
close the timerfd on exit.
vaxerski
vaxerski previously approved these changes Jul 31, 2024
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

danke

@vaxerski
Copy link
Member

no pch failed

@gulafaran
Copy link
Contributor Author

no pch failed

ah yeah just noticed, fixing. uno minuto.

instead of opening and closing the logfile on each write open it on init
and close it on compositor exit. also add a mutex so accidently using
logging from a thread like the watchdog or similiar doesnt cause issues.
check if the fd is actually opened before closing, and close the
pipesource FD on exit.
@gulafaran
Copy link
Contributor Author

no pch failed

fixed.

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sehr schoen

@vaxerski vaxerski merged commit 5489682 into hyprwm:main Jul 31, 2024
10 checks passed
@jbeich jbeich mentioned this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants