Commit 27953f00 authored by Xavier Thompson's avatar Xavier Thompson

Improve and fix mistake in cypclass trywlock implementation

parent 05c09d62
...@@ -119,11 +119,8 @@ ...@@ -119,11 +119,8 @@
} }
int CyObject_TRYWLOCK() const { int CyObject_TRYWLOCK() const {
uint32_t prev_readers = _readers; uint32_t prev_readers = 0;
if (prev_readers == 0) { return _readers.compare_exchange_strong(prev_readers, HAS_WRITER) - 1;
return _readers.compare_exchange_weak(prev_readers, HAS_WRITER) - 1;
}
return -1;
} }
void CyObject_UNWLOCK() const { void CyObject_UNWLOCK() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment