If I try to do the code snippet below, to have a background task wait for a message over IPC I get a compiler error:
`Cell<isize>` cannot be shared between threads safely
Is there any reason the sender field of Bootstrapper can't be changed from a RefCell to an Arc which would make this possible? Or is there a different way to go about what I am trying to achieve?
tokio::spawn(async move {
let bootstrapper = {
let bootstrapper = tokio_unix_ipc::Bootstrapper::bind("/tmp/test-uds").unwrap();
bootstrapper.send(Message::Sender(tx)).await.unwrap();
bootstrapper
};
tokio::select! {
res = rx.recv() => {
if let Ok(msg) = res {
match msg {
_ => {}
}
}
}
};
});
If I try to do the code snippet below, to have a background task wait for a message over IPC I get a compiler error:
Is there any reason the
sender
field ofBootstrapper
can't be changed from aRefCell
to anArc
which would make this possible? Or is there a different way to go about what I am trying to achieve?