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

Add thread local unchecked APIs #9

Merged
merged 4 commits into from
Jan 4, 2024
Merged

Conversation

pedromfedricci
Copy link
Owner

@pedromfedricci pedromfedricci commented Jan 4, 2024

Add two new locking APIs for thread_local::Mutex:

  • try_lock_with_unchecked
  • lock_with_unchecked

Both APIs are unsafe, but are more efficient, specially at hot paths, as they opt-out the runtime borrow checking. Users must guarantee that no more than one thread_local::MutexGuard are alive within a single thread at any time.

Add caller location for try_lock_with and lock_with APIs for better debugging experience when panicking.

@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2d7b02d) 96.80% compared to head (167b893) 96.52%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #9      +/-   ##
==========================================
- Coverage   96.80%   96.52%   -0.29%     
==========================================
  Files           5        5              
  Lines         219      230      +11     
==========================================
+ Hits          212      222      +10     
- Misses          7        8       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pedromfedricci pedromfedricci merged commit 50b7a11 into main Jan 4, 2024
9 checks passed
@pedromfedricci pedromfedricci deleted the thread-local-unchecked branch January 4, 2024 01:26
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.

2 participants