@@ -69,9 +69,6 @@ pub struct VcpuConfig {
6969 pub cpu_config : CpuConfiguration ,
7070}
7171
72- // Using this for easier explicit type-casting to help IDEs interpret the code.
73- type VcpuCell = RefCell < Option < KvmRunWrapper > > ;
74-
7572/// Error type for [`Vcpu::start_threaded`].
7673#[ derive( Debug , derive_more:: From , thiserror:: Error ) ]
7774#[ error( "Failed to spawn vCPU thread: {0}" ) ]
@@ -88,7 +85,7 @@ pub enum CopyKvmFdError {
8885 CreateVcpuError ( #[ from] kvm_ioctls:: Error ) ,
8986}
9087
91- thread_local ! ( static TLS_VCPU_PTR : VcpuCell = const { RefCell :: new( None ) } ) ;
88+ thread_local ! ( static TLS_VCPU_PTR : RefCell < Option < KvmRunWrapper >> = const { RefCell :: new( None ) } ) ;
9289
9390/// A wrapper around creating and using a vcpu.
9491#[ derive( Debug ) ]
@@ -123,7 +120,7 @@ impl Vcpu {
123120 std:: mem:: size_of :: < kvm_bindings:: kvm_run > ( ) ,
124121 )
125122 . unwrap ( ) ;
126- TLS_VCPU_PTR . with ( |cell : & VcpuCell | {
123+ TLS_VCPU_PTR . with ( |cell| {
127124 assert ! ( cell. borrow( ) . is_none( ) ) ;
128125 * cell. borrow_mut ( ) = Some ( kvm_run_ptr) ;
129126 } )
@@ -135,7 +132,7 @@ impl Vcpu {
135132 self . init_thread_local_data ( ) ;
136133
137134 extern "C" fn handle_signal ( _: c_int , _: * mut siginfo_t , _: * mut c_void ) {
138- TLS_VCPU_PTR . with ( |cell : & VcpuCell | {
135+ TLS_VCPU_PTR . with ( |cell| {
139136 if let Some ( kvm_run_ptr) = & mut * cell. borrow_mut ( ) {
140137 kvm_run_ptr. as_mut_ref ( ) . immediate_exit = 1 ;
141138 fence ( Ordering :: Release ) ;
0 commit comments