Fixing broken spinlock.

This commit is contained in:
Ben Vanik 2014-01-05 00:28:59 -08:00
parent c857d8da35
commit 29208a7fae
1 changed files with 2 additions and 1 deletions

View File

@ -751,12 +751,13 @@ void xeRtlEnterCriticalSection(uint32_t cs_ptr, uint32_t thread_id) {
uint32_t spin_wait_remaining = cs->spin_count_div_256 * 256;
spin:
if (xe_atomic_inc_32(&cs->lock_count)) {
if (xe_atomic_inc_32(&cs->lock_count) != 0) {
// If this thread already owns the CS increment the recursion count.
if (cs->owning_thread_id == thread_id) {
cs->recursion_count++;
return;
}
xe_atomic_dec_32(&cs->lock_count);
// Thread was locked - spin wait.
if (spin_wait_remaining) {