[Rpm-maint] [rpm-software-management/rpm] Turn nrefs into atomic_int (PR #3370)

Florian Festi notifications at github.com
Mon Oct 14 17:02:35 UTC 2024


Yes, this is just about `nrefs` and does not add thread safety for the content of the data types.

`--nrefs` decreases the nrefs and returns the new value atomically. As reaching 0 means no one has a reference it "can not" increase again. So checking the value later is fine. Note that we get a copy of the value returned from `--nrefs` so other changes to the `nrefs` attibute won't change the return value of the `--` operator.

So during the `--` operator the decision if made whether we need to free the instance. And we get a copy of that decision. So the *Free() function is not racy.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3370#issuecomment-2411799018
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/3370/c2411799018 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20241014/383197ab/attachment.html>


More information about the Rpm-maint mailing list