Thanks @danbruder and @DoumanAsh. Spawning my application_manager (appmngr)
let f_am = tokio::spawn(async move {
process::appmngr::run(
context.clone(), config.clone()).await;
});
now produces the following error:
57 | let f_am = tokio::spawn(async move {
| ^^^^^^^^^^^^^^ `*mut std::ffi::c_void` cannot be shared between threads safely
|
::: /home/hjansen/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.20/src/task/spawn.rs:127:21
|
127 | T: Future + Send + 'static,
| ---- required by this bound in `tokio::task::spawn::spawn`
|
= help: within `tmq::socket_types::request_reply::RequestReceiver`, the trait `std::marker::Sync` is not implemented for `*mut std::ffi::c_void`
= note: required because it appears within the type `zmq::Socket`
= note: required because it appears within the type `tmq::socket::SocketWrapper`
= note: required because it appears within the type `std::option::Option<tmq::socket::SocketWrapper>`
= note: required because it appears within the type `tokio::io::poll_evented::PollEvented<tmq::socket::SocketWrapper>`
= note: required because it appears within the type `tmq::poll::ZmqPoller`
= note: required because it appears within the type `tmq::socket_types::request_reply::RequestReceiver`
= note: required because of the requirements on the impl of `std::marker::Send` for `&tmq::socket_types::request_reply::RequestReceiver`
= note: required because it appears within the type `[closure@tmq::socket_types::request_reply::RequestReceiver::recv::{{closure}}#0::{{closure}}#0 0:&tmq::socket_types::request_reply::RequestReceiver]`
= note: required because it appears within the type `for<'r, 's> {std::future::ResumeTy, tmq::socket_types::request_reply::RequestReceiver, [closure@tmq::socket_types::request_reply::RequestReceiver::recv::{{closure}}#0::{{closure}}#0 0:&'r tmq::socket_types::request_reply::RequestReceiver], futures_util::future::poll_fn::PollFn<[closure@tmq::socket_types::request_reply::RequestReceiver::recv::{{closure}}#0::{{closure}}#0 0:&'s tmq::socket_types::request_reply::RequestReceiver]>, ()}`
= note: required because it appears within the type `[static generator@tmq::socket_types::request_reply::RequestReceiver::recv::{{closure}}#0 0:tmq::socket_types::request_reply::RequestReceiver for<'r, 's> {std::future::ResumeTy, tmq::socket_types::request_reply::RequestReceiver, [closure@tmq::socket_types::request_reply::RequestReceiver::recv::{{closure}}#0::{{closure}}#0 0:&'r tmq::socket_types::request_reply::RequestReceiver], futures_util::future::poll_fn::PollFn<[closure@tmq::socket_types::request_reply::RequestReceiver::recv::{{closure}}#0::{{closure}}#0 0:&'s tmq::socket_types::request_reply::RequestReceiver]>, ()}]`
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@tmq::socket_types::request_reply::RequestReceiver::recv::{{closure}}#0 0:tmq::socket_types::request_reply::RequestReceiver for<'r, 's> {std::future::ResumeTy, tmq::socket_types::request_reply::RequestReceiver, [closure@tmq::socket_types::request_reply::RequestReceiver::recv::{{closure}}#0::{{closure}}#0 0:&'r tmq::socket_types::request_reply::RequestReceiver], futures_util::future::poll_fn::PollFn<[closure@tmq::socket_types::request_reply::RequestReceiver::recv::{{closure}}#0::{{closure}}#0 0:&'s tmq::socket_types::request_reply::RequestReceiver]>, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `{std::future::ResumeTy, std::sync::Arc<zmq::Context>, std::sync::Arc<config::Config>, tmq::socket_types::request_reply::RequestReceiver, impl std::future::Future, (), tmq::message::Multipart, tmq::socket_types::request_reply::RequestSender, impl std::future::Future}`
= note: required because it appears within the type `[static generator@src/bin/sxsim/control/process/appmngr.rs:28:26: 50:2 context:std::sync::Arc<zmq::Context>, config:std::sync::Arc<config::Config> {std::future::ResumeTy, std::sync::Arc<zmq::Context>, std::sync::Arc<config::Config>, tmq::socket_types::request_reply::RequestReceiver, impl std::future::Future, (), tmq::message::Multipart, tmq::socket_types::request_reply::RequestSender, impl std::future::Future}]`
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@src/bin/sxsim/control/process/appmngr.rs:28:26: 50:2 context:std::sync::Arc<zmq::Context>, config:std::sync::Arc<config::Config> {std::future::ResumeTy, std::sync::Arc<zmq::Context>, std::sync::Arc<config::Config>, tmq::socket_types::request_reply::RequestReceiver, impl std::future::Future, (), tmq::message::Multipart, tmq::socket_types::request_reply::RequestSender, impl std::future::Future}]>`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `impl std::future::Future`
= note: required because it appears within the type `for<'r, 's> {std::future::ResumeTy, &'r std::sync::Arc<zmq::Context>, std::sync::Arc<zmq::Context>, &'s std::sync::Arc<config::Config>, std::sync::Arc<config::Config>, impl std::future::Future, ()}`
= note: required because it appears within the type `[static generator@src/bin/sxsim/control/server.rs:57:46: 60:10 context:std::sync::Arc<zmq::Context>, config:std::sync::Arc<config::Config> for<'r, 's> {std::future::ResumeTy, &'r std::sync::Arc<zmq::Context>, std::sync::Arc<zmq::Context>, &'s std::sync::Arc<config::Config>, std::sync::Arc<config::Config>, impl std::future::Future, ()}]`
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@src/bin/sxsim/control/server.rs:57:46: 60:10 context:std::sync::Arc<zmq::Context>, config:std::sync::Arc<config::Config> for<'r, 's> {std::future::ResumeTy, &'r std::sync::Arc<zmq::Context>, std::sync::Arc<zmq::Context>, &'s std::sync::Arc<config::Config>, std::sync::Arc<config::Config>, impl std::future::Future, ()}]>`
= note: required because it appears within the type `impl std::future::Future`
Is any of the underlying crates I use incompatible with Tokio/async, or can this be remedied?