smol-rs / async-channel

Async multi-producer multi-consumer channel
Apache License 2.0
769 stars 39 forks source link

Fix Weak Increment Race Condition #60

Closed jayhf closed 1 year ago

jayhf commented 1 year ago

The sender/receiver counts are currently read and updated separately, which means there's a possible race condition where two attempt to get upgraded from different threads at the same time. This PR switches to using fetch_update to avoid this issue

jayhf commented 1 year ago

@notgull CI is passing now, except the MSRV check is failing, seemingly due a flaky failure to download the Cargo registry. Could you please rerun that action? I don't have permission