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

TODO: Fix signal so that this can be an "if" instead of "while" #69

Open
bullno1 opened this issue May 1, 2024 · 0 comments
Open

TODO: Fix signal so that this can be an "if" instead of "while" #69

bullno1 opened this issue May 1, 2024 · 0 comments

Comments

@bullno1
Copy link

bullno1 commented May 1, 2024

I'm trying to port the spsc queue to use C11 thread and atomic and I encounter this comment:

https://github.com/mattiasgustavsson/libs/blob/main/thread.h#L1401

As far as I can tell, the current signal is already guarding against spurious wake up with a while loop:

https://github.com/mattiasgustavsson/libs/blob/main/thread.h#L970-L974

https://github.com/mattiasgustavsson/libs/blob/main/thread.h#L998-L1008

What else needs to be fixed?
Can this just be switched to if instead?
It saves one atomic load which doesn't seem to be much in the grand scheme of things but still it's something.

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

No branches or pull requests

1 participant