Hey guys,
I've been trying to move a JObject from the main thread to the inner thread. I've tried implementing Channel, Arc and Mutex to share the object, but all of them gave me the same error.
error[E0277]: `*mut jni::sys::_jobject` cannot be sent between threads safely
--> src/lib.rs:88:19
|
88 | let handle2 = thread::spawn(move || {
| ^^^^^^^^^^^^^ `*mut jni::sys::_jobject` cannot be sent between threads safely
|
= help: within `jni::objects::JObject<'_>`, the trait `std::marker::Send` is not implemented for `*mut
jni::sys::_jobject`
= note: required because it appears within the type `jni::objects::JObject<'_>`
= note: required because of the requirements on the impl of `std::marker::Send` for
`std::sync::Arc<jni::objects::JObject<'_>>`
= note: required because it appears within the type `[closure@src/lib.rs:88:33: 106:6 JVM:jni::JavaVM,
outerobj:std::sync::Arc<jni::objects::JObject<'_>>]`
= note: required by `std::thread::spawn`
How do i fix this?? Thank you.