stats_waiting should be unsigned.  Maybe add an `assert(item->stats_waiting > 0)` just before to guard against underflow?