8000 Added missing state rollback for failed attempt-based write locking o… · arangodb/arangodb@10e6357 · GitHub
[go: up one dir, main page]

Skip to content

Commit 10e6357

Browse files
jsteemannKVS85
andauthored
Added missing state rollback for failed attempt-based write locking of spin locks (#12172)
* Disable non-relevant testsuites * Added missing state rollback for failed attempt-based write locking of spin locks. Co-authored-by: KVS85 <vadim@arangodb.com>
1 parent a9eec63 commit 10e6357

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Basics/ReadWriteSpinLock.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,17 @@ class ReadWriteSpinLock {
8484
return true;
8585
}
8686
if (++attempts > maxAttempts) {
87+
// Undo the counting of us as queued writer:
88+
_state.fetch_sub(QUEUED_WRITER_INC, std::memory_order_release);
8789
return false;
8890
}
8991
}
9092
cpu_relax();
9193
state = _state.load(std::memory_order_relaxed);
9294
}
95+
96+
// Undo the counting of us as queued writer:
97+
_state.fetch_sub(QUEUED_WRITER_INC, std::memory_order_release);
9398
return false;
9499
}
95100

0 commit comments

Comments
 (0)
0