Skip to content

Commit

Permalink
sem: Restructure calculation of waiter count a little
Browse files Browse the repository at this point in the history
  • Loading branch information
lhmouse committed Jan 8, 2024
1 parent cc9a9a8 commit eea208c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mcfgthread/sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ _MCF_sem_signal_some(_MCF_sem* sem, intptr_t value_add)
return -2; /* would overflow */

new = old;
wake_num = _MCF_minz(-(size_t) old.__value, (size_t) value_add) & (size_t) (old.__value >> (__MCF_PTR_BITS - 1));
wake_num = _MCF_minz(-(size_t) (old.__value & (old.__value >> (__MCF_PTR_BITS - 1))), (size_t) value_add);
new.__value = old.__value + value_add;
}
while(!_MCF_atomic_cmpxchg_weak_pptr_rlx(sem, &old, &new));
Expand Down

0 comments on commit eea208c

Please sign in to comment.