]> git.ipfire.org Git - thirdparty/qemu.git/commit
qobject: make refcount atomic
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 30 Sep 2025 11:17:11 +0000 (13:17 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 28 Oct 2025 12:02:26 +0000 (13:02 +0100)
commitdc72ba5dc48c69b2f2bc79c0e977a9cb8b7b01e4
tree1277e7a7ba857f08ac1ac0e4f3e8c3bf326d34ce
parent025a1d344d8ce6c889933926071edc799ad81390
qobject: make refcount atomic

The Rust bindings for QObject will only operate on complete objects,
treating them as immutable as long as the Rust QObject is live.

With that constraint, it is trivial for Rust code to treat QObjects as
thread-safe; all that's needed is to make reference count operations
atomic.  Do the same when the C code adds or removes references, since
we don't really know what the Rust code is up to; of course C code will
have to agree with not making changes to the QObjects after they've
been passed to Rust code.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qobject/qobject.h