Replies: 2 comments 4 replies
-
What's interesting is that the solution I proposed doesn't work with traits where methods are invoked via dynamic dispatch. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ah, looks like returning the future from the If I return a struct then it uses the parent Tokio runtime but that doesn't work when returning a trait. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm writing an application that dynamically consumes a library that has some extern functions exported via Rust's FFI
Using
libloading
I load thelib.so
file, obtain the init function, run it andawait
the future it returns.The tokio runtime is executed in the main application and I assumed the context would be shared with dynamically loaded library however, at the
tokio::spawn
, I get the error:I assume that means the solution would be to spawn a new tokio runtime within the dynamic library, this seems to work.
I was hoping I could reuse the tokio runtime from the host process, is that possible?
Otherwise, what sort of performance implications are there for having a second tokio engine running in the dynamic library?
Beta Was this translation helpful? Give feedback.
All reactions