-
Notifications
You must be signed in to change notification settings - Fork 786
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 atomic enum election::state_m and instead require locking election::mutex. #4318
Remove atomic enum election::state_m and instead require locking election::mutex. #4318
Conversation
298b348
to
e174edf
Compare
@clemahieu, could you explain why this change is needed, what problem does it solve. |
This change is removing the atomic election::state_m variable in favor of using the election mutex for synchronization. The issue is there are two synchronization mechanisms in use, locking the mutex or doing an atomic compare exchange, which has race conditions. From what I recall the election can be doing an operation with a locked mutex, and a separate action can change the election state because it doesn't respect the mutex being locked. |
…oesn't need to be evaluated when debugging is off.
A mutex was needlessly being passed from function to function and a function wrapper existed needlessly.
97595c8
to
345e1d8
Compare
…able The critical section is now obvious and easy to see
345e1d8
to
b44be68
Compare
LGTM |
No description provided.