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

clear is not thread-safe wrt memory visibility #6

Open
jayv opened this issue Jan 14, 2021 · 0 comments
Open

clear is not thread-safe wrt memory visibility #6

jayv opened this issue Jan 14, 2021 · 0 comments

Comments

@jayv
Copy link

jayv commented Jan 14, 2021

void Timer::stop() {
    this->clear = true;
}

clear as plain bool has no cross-thread synchronization so in theory the interval timer may run indefinitly, consider using atomic_bool and proper memory ordering.

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