Zebediah Figura (@zfigura) commented about dlls/ntdll/sync.c:
old.Ptr = ReadPointerAcquire(&lock->Ptr);
tag = srwlock_get_tag(old);
last = srwlock_get_waiter(old);
assert(!(tag & SRWLOCK_TAG_LIST_LOCKED));
tag |= SRWLOCK_TAG_LIST_LOCKED;
new = srwlock_from_waiter(last, tag);
- } while (InterlockedCompareExchangePointer(&lock->Ptr, new.Ptr, old.Ptr) !=
old.Ptr);
- assert(tag & SRWLOCK_TAG_HAS_WAITERS);
- old = new;
- last = srwlock_get_waiter(old);
- assert(last != NULL);
- head = last->head;
- assert(head != NULL);
It's not a big deal, but I think these assertions are superfluous if you're going to immediately dereference the variables. And, well, that means they kind of clutter the code.