These writes to `pending->calls_to_do` need to be atomic, because other threads
can read (atomically) from `calls_to_do` without holding `pending->mutex`.
pending->calls[i].flags = flags;
pending->last = j;
assert(pending->calls_to_do < NPENDINGCALLS);
- pending->calls_to_do++;
+ _Py_atomic_add_int32(&pending->calls_to_do, 1);
return 0;
}
pending->calls[i] = (struct _pending_call){0};
pending->first = (i + 1) % NPENDINGCALLS;
assert(pending->calls_to_do > 0);
- pending->calls_to_do--;
+ _Py_atomic_add_int32(&pending->calls_to_do, -1);
}
}