object send+sync, probably a bad idea
This commit is contained in:
@@ -33,6 +33,9 @@ pub struct Object {
|
||||
pub(crate) data_addr: *const u32,
|
||||
}
|
||||
|
||||
unsafe impl Send for Object {}
|
||||
unsafe impl Sync for Object {}
|
||||
|
||||
impl Object {
|
||||
/// Try and transmute this SimConnect object as a `T` struct.
|
||||
///
|
||||
|
@@ -31,8 +31,6 @@ fn main() -> Result<(), anyhow::Error> {
|
||||
|
||||
// .subscribe(SomeEvent);
|
||||
|
||||
let mut id = 0;
|
||||
|
||||
let ctrl_c = CtrlC::new();
|
||||
|
||||
loop {
|
||||
@@ -41,7 +39,7 @@ fn main() -> Result<(), anyhow::Error> {
|
||||
Notification::Open => {
|
||||
simconnect.subscribe_to_system_event(SystemEventRequest::FlightLoaded)?;
|
||||
|
||||
simconnect.register_object::<AtcID>()?;
|
||||
let id = simconnect.register_object::<AtcID>()?;
|
||||
simconnect.register_object::<Fuel>()?;
|
||||
|
||||
let cs = CString::new("ITWORKS")?;
|
||||
@@ -50,7 +48,8 @@ fn main() -> Result<(), anyhow::Error> {
|
||||
buffer[i] = *b as i8;
|
||||
}
|
||||
|
||||
simconnect.set_data_on_sim_object(&mut AtcID { value: buffer })?;
|
||||
simconnect
|
||||
.set_data_on_sim_object_with_id(id, &mut AtcIDCPacked { value: buffer })?;
|
||||
tracing::info!("ATC_ID set");
|
||||
|
||||
simconnect.set_data_on_sim_object(&mut Fuel {
|
||||
@@ -78,6 +77,7 @@ fn main() -> Result<(), anyhow::Error> {
|
||||
buffer[i] = *b as i8;
|
||||
}
|
||||
|
||||
let id = simconnect.get_object_id::<AtcID>()?;
|
||||
simconnect.set_data_on_sim_object_with_id(
|
||||
id,
|
||||
&mut AtcIDCPacked { value: buffer },
|
||||
|
Reference in New Issue
Block a user