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

improve: use modern implementations to manage threads #1756

Merged
merged 3 commits into from
Nov 2, 2023
Merged

Conversation

mehah
Copy link
Contributor

@mehah mehah commented Oct 27, 2023

Improvement: Modernized Thread Management

Description:
This pull request updates the thread management constructs within the codebase. It shifts from using std::lock_guard to std::scoped_lock for managing mutexes, providing a more modern and safer scope-based locking mechanism. Additionally, it replaces std::condition_variable with std::atomic::wait, leveraging the more efficient and scalable waiting and notification system provided by atomics.

Benefits:

  • std::scoped_lock is more flexible than std::lock_guard, allowing for handling multiple mutexes without the risk of deadlock.
  • std::atomic::wait introduces potential performance gains by utilizing a more lightweight synchronization mechanism compared to traditional condition variables.

Impact:
These improvements are expected to enhance the safety and efficiency of concurrent operations. They modernize the codebase, aligning it with current best practices for C++ concurrency.

@dudantas dudantas merged commit 57b4593 into main Nov 2, 2023
@dudantas dudantas deleted the thread_c20 branch November 2, 2023 19:16
Copy link

sonarqubecloud bot commented Nov 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

marcusvcj pushed a commit to marcusvcj/canary that referenced this pull request Nov 4, 2023
This updates the thread management constructs within the codebase. It shifts from using std::lock_guard to std::scoped_lock for managing mutexes, providing a more modern and safer scope-based locking mechanism. Additionally, it replaces std::condition_variable with std::atomic::wait, leveraging the more efficient and scalable waiting and notification system provided by atomics.

Benefits:
• std::scoped_lock is more flexible than std::lock_guard, allowing for handling multiple mutexes without the risk of deadlock.
• std::atomic::wait introduces potential performance gains by utilizing a more lightweight synchronization mechanism compared to traditional condition variables.

Impact:
• These improvements are expected to enhance the safety and efficiency of concurrent operations. They modernize the codebase, aligning it with current best practices for C++ concurrency.
marcusvcj pushed a commit to marcusvcj/canary that referenced this pull request Nov 20, 2023
This updates the thread management constructs within the codebase. It shifts from using std::lock_guard to std::scoped_lock for managing mutexes, providing a more modern and safer scope-based locking mechanism. Additionally, it replaces std::condition_variable with std::atomic::wait, leveraging the more efficient and scalable waiting and notification system provided by atomics.

Benefits:
• std::scoped_lock is more flexible than std::lock_guard, allowing for handling multiple mutexes without the risk of deadlock.
• std::atomic::wait introduces potential performance gains by utilizing a more lightweight synchronization mechanism compared to traditional condition variables.

Impact:
• These improvements are expected to enhance the safety and efficiency of concurrent operations. They modernize the codebase, aligning it with current best practices for C++ concurrency.
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.

3 participants