tari icon indicating copy to clipboard operation
tari copied to clipboard

Replace unsafe Send and Sync on RandomXVMInstance

Open stringhandler opened this issue 1 year ago • 0 comments

Currently there are unsafe impls of these traits on RandomXVMInstance.

#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for RandomXVMInstance {}
unsafe impl Sync for RandomXVMInstance {}

While this allows the code to compile, I believe there is a better way to wrap these instances in a way that is more idiomatic to rust.

Already there was a panic, fixed by #5734 but there could be more unsafe problems

It could probably also benefit from a better readwrite lock implementation like tokio's.

stringhandler avatar Sep 04 '23 15:09 stringhandler