Skip to content

Remove atomic enum election::state_m and instead require locking election::mutex.#4318

Merged
clemahieu merged 9 commits intonanocurrency:developfrom
clemahieu:election_state_mutex
Jan 16, 2024
Merged

Remove atomic enum election::state_m and instead require locking election::mutex.#4318
clemahieu merged 9 commits intonanocurrency:developfrom
clemahieu:election_state_mutex

Conversation

@clemahieu
Copy link
Copy Markdown
Contributor

No description provided.

@clemahieu clemahieu force-pushed the election_state_mutex branch 5 times, most recently from 298b348 to e174edf Compare November 7, 2023 12:41
@dsiganos
Copy link
Copy Markdown
Contributor

dsiganos commented Jan 10, 2024

@clemahieu, could you explain why this change is needed, what problem does it solve.

@clemahieu
Copy link
Copy Markdown
Contributor Author

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.

@dsiganos dsiganos force-pushed the election_state_mutex branch from 97595c8 to 345e1d8 Compare January 12, 2024 14:01
@dsiganos dsiganos force-pushed the election_state_mutex branch from 345e1d8 to b44be68 Compare January 12, 2024 22:55
@clemahieu
Copy link
Copy Markdown
Contributor Author

LGTM

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.

3 participants