feat(sync): add read-write lock primitive - #1877
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1877 +/- ##
==========================================
+ Coverage 74.29% 74.31% +0.02%
==========================================
Files 103 103
Lines 26811 26817 +6
Branches 4887 4881 -6
==========================================
+ Hits 19918 19928 +10
- Misses 5554 5555 +1
+ Partials 1339 1334 -5 🚀 New features to boost your workflow:
|
495cd85 to
05fe336
Compare
3c7c966 to
4948141
Compare
7cfebae to
ed216c7
Compare
4948141 to
0b0e77c
Compare
c7f80db to
b901758
Compare
dab304d to
b899738
Compare
b899738 to
853172c
Compare
853172c to
dcbac0c
Compare
8891408 to
f197136
Compare
c5ebf17 to
b4d7fb8
Compare
fd41b34 to
219277a
Compare
ed71879 to
12cec9b
Compare
219277a to
b5546d7
Compare
|
Add `sentry_rwlock_t` backed by platform native RW locks.
b5546d7 to
cf2aa1a
Compare
| # define sentry__rwlock_read_lock(Lock) AcquireSRWLockShared(Lock) | ||
| # define sentry__rwlock_read_unlock(Lock) ReleaseSRWLockShared(Lock) | ||
| # define sentry__rwlock_write_lock(Lock) AcquireSRWLockExclusive(Lock) | ||
| # define sentry__rwlock_write_unlock(Lock) ReleaseSRWLockExclusive(Lock) |
There was a problem hiding this comment.
Will sentry_rwlock_t be potentially used recursively? It shouldn't because MS documents it as "should not be acquired recursively". Recursive access (same thread) can deadlock. We should acknowledge that in a comment at least.
There was a problem hiding this comment.
This won't be used recursively, no. We will no longer lock across function calls that might need the same lock recursively, but only for the duration of reading or writing a piece of (scope) data.
How's this description?
A non-recursive read-write lock for short critical sections around protected variable access. Allows multiple concurrent readers, or a single exclusive writer.
Based on
SRWLOCKon Windows, andpthread_rwlock_ton POSIX.
Add
sentry_rwlock_t, backed by platform-native RW locks. Will be used for scope data in #2042.#skip-changelog (internal)