mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-09 00:07:57 -06:00
rust: cell: add BQL-enforcing RefCell variant
Similar to the existing BqlCell, introduce a custom interior mutability primitive that resembles RefCell but accounts for QEMU's threading model. Borrowing the RefCell requires proving that the BQL is held, and attempting to access without the BQL is a runtime panic. Almost all of the code was taken from Rust's standard library, while removing unstable features and probably-unnecessary functionality that amounts to 60% of the original code. A lot of what's left is documentation, as well as unit tests in the form of doctests. These are not yet integrated in "make check" but can be run with "cargo test --doc". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
8e194c0ea5
commit
c596199f63
3 changed files with 539 additions and 11 deletions
|
@ -6,6 +6,9 @@ _qemu_api_cfg = run_command(rustc_args,
|
|||
if rustc.version().version_compare('>=1.77.0')
|
||||
_qemu_api_cfg += ['--cfg', 'has_offset_of']
|
||||
endif
|
||||
if get_option('debug_mutex')
|
||||
_qemu_api_cfg += ['--feature', 'debug_cell']
|
||||
endif
|
||||
|
||||
_qemu_api_rs = static_library(
|
||||
'qemu_api',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue