Zebediah Figura (@zfigura) commented about dlls/ntdll/sync.c:
--new.s.exclusive_waiters;
wait = FALSE;
new_head = tmp;
last_up_to_date = last_to_remove; }
else
if (!new_head)
break;
if (last_to_remove->state & SRWLOCK_WAITER_STATE_IS_EXCLUSIVE) {
wait = TRUE;
new_head->num_owners = SRWLOCK_WAITER_EXCLUSIVELY_LOCKED;
break; }
} while (InterlockedCompareExchange( u.l, new.l, old.l ) != old.l);
new_head->num_owners = last_to_remove->num_owners + 1;
Depending on how and if this is restructured, making this a local variable may be a good idea. It should be more performant, at least.