mirror of
https://github.com/qemu/qemu.git
synced 2026-02-04 05:35:39 +00:00
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>